Submission
Status:
[PPP-SSSSSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: 12345678
Problemset: anna
Language: cpp
Time: 0.002 second
Submitted On: 2025-11-09 11:09:54
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n, a[5], b[5];
bool same()
{
for (int i=0; i<5; i++) if (a[i]!=b[i]) return 0;
return 1;
}
void solve()
{
for (int i=0; i<5; i++) cin>>a[i];
sort(a, a+5);
set<pair<ll, ll>> s;
for (int l=0; l<5; l++)
{
for (int r=l+1; r<5; r++)
{
ll x=a[r], y=a[l];
if ((x+y)%2) continue;
ll A=(x+y)/2, B=(x-y)/2;
if (A<1||1e6<A||B<1||1e6<B) continue;
b[0]=A+B;
b[1]=A-B;
b[2]=A/B;
b[3]=A*B;
b[4]=A%B;
sort(b, b+5);
if (same()) s.insert({A, B});
}
}
if (s.empty()||s.size()>1) cout<<0<<' '<<0<<'\n';
else cout<<s.begin()->first<<' '<<s.begin()->second<<'\n';
}
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
int _t; cin>>_t;
while (_t--) solve();
}