Submission
Status:
[PPP-SSSSSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: theem1502
Problemset: anna
Language: cpp
Time: 0.003 second
Submitted On: 2026-02-17 14:03:06
#include <bits/stdc++.h>
using namespace std;
bool check(int a, int b, vector<int> &arr) {
int thenum = a+b;
bool thebool = false;
for (int i = 0; i < 5; i++) {
if (arr[i] == thenum) {
thebool = true;
break;
}
}
if (thebool == false) {
return false;
}
thenum = a-b;
thebool = false;
for (int i = 0; i < 5; i++) {
if (arr[i] == thenum) {
thebool = true;
break;
}
}
if (thebool == false) {
return false;
}
thenum = a*b;
thebool = false;
for (int i = 0; i < 5; i++) {
if (arr[i] == thenum) {
thebool = true;
break;
}
}
if (thebool == false) {
return false;
}
thenum = a/b;
thebool = false;
for (int i = 0; i < 5; i++) {
if (arr[i] == thenum) {
thebool = true;
break;
}
}
if (thebool == false) {
return false;
}
thenum = a%b;
thebool = false;
for (int i = 0; i < 5; i++) {
if (arr[i] == thenum) {
thebool = true;
break;
}
}
if (thebool == false) {
return false;
}
return true;
}
/*
void stuff() {
vector<int> arr(5);
for (int i = 0; i < 5; i++) {
cin >> arr[i];
}
sort(arr.begin(), arr.end());
for (int i = 0; i < 2; i++) {
for (int j = 2; j < 5; j++) {
int firstnum = arr[i];
int secnum = arr[j];
if ((firstnum + secnum) % 2 != 0 || (firstnum = secnum) % 2 != 0) {
continue;
}
int a = (firstnum + secnum) / 2, b = (firstnum - secnum) / 2;
if (check(a, b, arr)) {
cout << a << " " << b << "\n";
return;
}
}
}
cout << 0 << " " << 0 << "\n";
return;
}
*/
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int num;
cin >> num;
for (int k = 0; k < num; k++) {
vector<int> arr(5);
for (int i = 0; i < 5; i++) {
cin >> arr[i];
}
sort(arr.begin(), arr.end(), greater<int> ());
/*
for (auto x: arr) {
cout << x << " ";
}
cout << "\n";
*/
for (int i = 0; i < 2; i++) {
for (int j = 2; j < 5; j++) {
int firstnum = arr[i];
int secnum = arr[j];
// cout << "debug " << firstnum << " " << secnum << "\n";
if ((firstnum + secnum) % 2 != 0 || (firstnum - secnum) % 2 != 0) {
// cout << "no" << "\n";
continue;
}
int a = (firstnum + secnum) / 2, b = (firstnum - secnum) / 2;
if (check(a, b, arr)) {
cout << a << " " << b << "\n";
goto here;
}
}
}
cout << 0 << " " << 0 << "\n";
here:;
}
}