Submission

Status:

[PPP-SSSSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: KantaponZ

Problemset: anna

Language: cpp

Time: 0.003 second

Submitted On: 2025-08-24 13:37:59

#include <bits/stdc++.h>
using namespace std;

#define ll long long

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    int N;
    cin >> N;
    while (N--) {
        vector<ll> v(5);
        for (int i = 0; i < 5; i++) cin >> v[i];
        bool ok = 0;
        do {
            if ((v[0] + v[1]) % 2 || (v[0] - v[1]) % 2) continue;
            ll A = (v[0] + v[1]) / 2, B = (v[0] - v[1]) / 2;
            if (A * B != v[2]) continue;
            if (A / B != v[3]) continue;
            if (A % B != v[4]) continue;
            ok = 1;
            cout << A << " " << B << "\n";
            break;
        } while (next_permutation(v.begin(), v.end()));
        if (!ok) cout << "0 0\n";
    }
}