Submission
Status:
[PPPPPPPPPPPPPP]
Score: 100
User: njoop
Problemset: anna
Language: cpp
Time: 0.003 second
Submitted On: 2025-04-04 02:25:29
#include <bits/stdc++.h>
#define int long long
#define double long double
#define pii pair <int,int>
#define tiii tuple <int, int, int>
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define ub(a, b) upper_bound(a.begin(), a.end(), b) - a.begin()
#define lb(a, b) lower_bound(a.begin(), a.end(), b) - a.begin()
#define ve vector
#define graph(a, n) vector <int> a[n];
#define wgraph(a, n) vector <pii> a[n];
#define emb emplace_back
#define em emplace
#define ins insert
#define er erase
#define iShowSpeed cin.tie(NULL)->sync_with_stdio(false)
using namespace std;
template <typename T>
using greater_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const int mod = 1e9 + 7;
const int inf = 1e18;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int cnt = 0;
void solve(){
vector <int> a(5);
for (auto &e : a) cin >> e;
sort(all(a));
int x = 0, y = 0;
cnt = 0;
do {
if (a[0] < a[1] || a[2] < a[3] || (a[0] + a[1]) % 2 || a[1] <= 0) continue;
int xx = (a[0] + a[1]) / 2;
int yy = a[0] - xx;
if (yy <= 0) continue;
if (xx % yy != a[4]) continue;
if (xx * yy != a[2]) continue;
if (xx / yy != a[3]) continue;
x = xx, y = yy;
cnt++;
} while(next_permutation(all(a)));
// for (auto e : a) cout << e << " ";
// cout << ": ";
if(cnt != 1) cout << 0 << " " << 0 << "\n";
else cout << x << " " << y << "\n";
}
int32_t main(){
iShowSpeed;
int q; cin >> q; while (q--) solve();
}