Submission

Status:
[PPP-SSSSSSSSSS]

Score: 0

User: hmmm

Problemset: anna

Language: cpp

Time: 0.003 second

Submitted On: 2025-04-06 11:27:01

#include<bits/stdc++.h>
using namespace std;
int 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{
            int x=(a[1]-a[2])/2;
            int y=(a[1]+a[2])/2;
            // 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";
    }
}