Submission

Status:

[-SSSSSSSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: Nathlol2

Problemset: anna

Language: cpp

Time: 0.002 second

Submitted On: 2025-09-07 23:47:49

#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);
	vector<int> idx = {0, 1, 2, 3, 4};
	cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
	ll ans1 = 0, ans2 = 0;
	bool f = 0;
	do{
		ll x = a[idx[0]] + a[idx[1]];
		if(x % 2) continue;
		x /= 2;
		ll y = a[idx[0]] - x;
		if(x > 0 && y > 0 && x > y && y != 0 && x * y == a[idx[2]] && x % y == a[idx[3]] && x / y == a[idx[4]]) {
			if(f){
				ans1 = 0, ans2 = 0;
			}else{
				ans1 = x, ans2 = y;
				f = 1;
			}
		}
	}while(next_permutation(idx.begin(), idx.end()));
	cout << ans1 << ' ' << ans2 << '\n';
}

int main(){
	init();
	int tt;
	cin >> tt;
	while(tt--) solve();
}