Submission
Status:
[PPPP-SSSSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: Nathlol2
Problemset: anna
Language: cpp
Time: 0.003 second
Submitted On: 2025-09-07 23:50:18
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void init(){
ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifdef nath
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
void solve(){
vector<ll> a(5);
cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
ll ans1 = 0, ans2 = 0;
bool f = 0;
do{
ll x = a[0] + a[1];
if(x % 2) continue;
x /= 2;
ll y = a[0] - x;
if(x > 0 && y > 0 && x > y && x * y == a[2] && x % y == a[3] && x / y == a[4]) {
if(f){
ans1 = 0, ans2 = 0;
}else{
ans1 = x, ans2 = y;
f = 1;
}
}
}while(next_permutation(a.begin(), a.end()));
cout << ans1 << ' ' << ans2 << '\n';
}
int main(){
init();
int tt;
cin >> tt;
while(tt--) solve();
}