Submission
Status:
[-SSSSSSSSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: Gump2011
Problemset: anna
Language: cpp
Time: 0.002 second
Submitted On: 2026-03-08 16:59:37
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
while(n--){
vector<ll> x(5);
for(int i=0;i<5;i++) cin >> x[i];
sort(x.begin(), x.end());
ll ansA = -1, ansB = -1;
int cnt = 0;
for(int i=0;i<5;i++){
for(int j=0;j<5;j++){
if(i==j) continue;
ll s = x[i]; // A+B
ll d = x[j]; // A-B
if((s+d)%2) continue;
ll A = (s+d)/2;
ll B = (s-d)/2;
if(B<=0 || A<=B) continue;
vector<ll> t;
t.push_back(A+B);
t.push_back(A-B);
t.push_back(A*B);
t.push_back(A%B);
t.push_back(A/B);
sort(t.begin(), t.end());
if(t == x){
cnt++;
ansA = A;
ansB = B;
}
}
}
if(cnt==1) cout << ansA << " " << ansB << "\n";
else cout << "0 0\n";
}
}