Submission
Status:
[PPP-SSSSSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: yypp
Problemset: anna
Language: cpp
Time: 0.002 second
Submitted On: 2026-03-25 15:54:16
#include <bits/stdc++.h>
using namespace std;
bool dif5(unordered_map<long long,long long> &mp,int a,int b,int c,int d,int e) {
mp[a]--; mp[b]--; mp[c]--; mp[d]--; mp[e]--;
return mp[a]==0&&mp[b]==0&&mp[c]==0&&mp[d]==0&&mp[e]==0;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int n; bool fnd=false;
long long a[5],t1,x,y;
cin >> n;
for (int i=0;i<n;i++) {
fnd=false;
unordered_map<long long,long long> mp;
for (int j=0;j<5;j++) {
cin >> t1;
a[j] = t1;
mp[t1]++;
}
for (int j=0;j<5;j++) {
if (fnd == true) break;
for (int k=0;k<5;k++) {
//printf("%d %d\n",j,k);
if (j!=k) {
if ((a[j]+a[k])%2==0) {
x = (a[j]+a[k])/2; //a
y = max(a[j],a[k])-x; //b
if (y==0) continue;
//printf(" = %d %d\n",x,y);
//printf("ck %d %d %d \n",mp[x*y],mp[x/y],mp[x%y]);
if (mp[x*y]!=0&&mp[x/y]!=0&&mp[x%y]!=0&&dif5(mp,a[j],a[k],x*y,x/y,x%y)) {
cout << x << " " << y << "\n"; fnd=true; break;
}
}
}
}
}
if (fnd==false) cout << "0 0\n";
}
}