Submission
Status:
[P-SSSSSSSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: NovemNotes
Problemset: anna
Language: cpp
Time: 0.003 second
Submitted On: 2026-03-12 13:25:39
#include <bits/stdc++.h>
using namespace std;
#define int long long
int q;
int num[5];
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
cin >> q;
while(q--){
priority_queue<int> pq;
for(int i=0;i<5;i++){
int x;cin >> x;
pq.emplace(x);
}
int mul = pq.top(); pq.pop();
int plus = pq.top();pq.pop();
set<int> s;
while(!pq.empty()){
s.insert(pq.top());
pq.pop();
}
int l = 1,r = plus-1;
int a=-1;
while(l<=r){
int mid = l+(r-l)/2;
int another = plus-mid;
// cout << mid << " " << another << "\n";
if(mid*another == mul){
a=mid;
break;
}else if(mid*another < mul){
l=mid+1;
}else{
r=mid-1;
}
}
if(a==-1){
cout << "0 0\n";
}
a = max(a,plus-a);
int b = plus-a;
int minus = a-b;
int div = a/b;
int mod = a%b;
set<int> tmp;
tmp.insert(minus);
tmp.insert(div);
tmp.insert(mod);
if(tmp==s){
cout << a << " " << b << "\n";
}else{
cout << "0 0\n";
}
}
return 0;
}