Submission
Status:
[PPP-SSSSSSSSSS]
Score: 0
User: hmmm
Problemset: anna
Language: cpp
Time: 0.002 second
Submitted On: 2025-04-06 11:50:46
#include<bits/stdc++.h>
using namespace std;
using ll=long long int;
ll a[10];
int main(){
ios::sync_with_stdio(0); cin.tie(0);
int n;
cin >> n;
while(n--){
bool ans=false;
for(int i=1;i<=5;i++){
cin >> a[i];
}
sort(a+1,a+1+5);
do{
if((a[1]-a[2])%2==1 || (a[1]+a[2])%2==1) continue;
ll x=(a[1]+a[2])/2;
ll y=a[1]-x;
// cout << x << ' ' << y << "\n";
if(x<y) swap(x,y);
// if(y==0) continue;
if(y>0 && x*y==a[3] && x%y==a[4] && x/y==a[5]){
cout << x << ' ' << y << "\n";
ans=true;
break;
}
}while(next_permutation(a+1,a+6));
if(!ans) cout << "0 0\n";
}
}