Submission
Status:
[PPPP-SSSSSSSSS]
Subtask/Task Score:
{0/100}
Score: 0
User: kimza
Problemset: anna
Language: cpp
Time: 0.002 second
Submitted On: 2026-03-05 20:51:15
#include <bits/stdc++.h>
using namespace std;
void check(){
vector<int> s;
int v,w,x,y,z;
cin >> v >> w >> x >> y >> z;
s.push_back(v);
s.push_back(w);
s.push_back(x);
s.push_back(y);
s.push_back(z);
sort(s.begin(),s.end(),greater<int>());
int a=0,b=0;
if(s[1]-s[0]!=1){
//find a,b
int b1 = (s[1]+sqrt((s[1]*s[1])-(4*s[0])))/2;
int b2 = (s[1]-sqrt((s[1]*s[1])-(4*s[0])))/2;
if(b1 < 0 || b2 < 0) {a=0;b=0;} //end this loop
else{
if(b1 > b2) {a = b1; b = b2;}
else if(b2 > b1) {a = b2; b = b1;}
else if (b2 == b1) {a=0;b=0;}
}
}
else{
b = 1;
a = s[0]-1;
}
//cout << a << " " << b;
//check----------------------------------------------------------------------------
int cs = a-b;//checksubtraction
int cm = a%b;//checkmod
int cd = a/b;//checkdivide
vector<int> check;
check.push_back(cs);
check.push_back(cm);
check.push_back(cd);
sort(check.begin(),check.end(),greater<int>());
if(check[0]==s[2] && check[1]==s[3] && check[2]==s[4]) {a=a;b=b;}
else {a=0;b=0;}
cout << a << " " << b << "\n";
}
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
for(int i=0;i<n;i++){
check();
//check if theres more than 1 ans if so , 0 0 if not that.
}
return 0;
}