Submission

Status:

[PPP-SSSSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: qweqwe

Problemset: anna

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-21 21:17:02

#include <bits/stdc++.h>
#define speed cin.tie(0)->sync_with_stdio(0)
#define ll long long
#define pii pair<int,int>
using namespace std;

int main(){
	speed;
	ll n;cin >> n;
	for (int i=0;i<n;i++){
		vector<ll> v(5);
		ll mx=0;
		for (int j=0;j<5;j++){
			cin >> v[j];mx=max(mx,v[j]);
		}
		ll a,b;a=min(mx,(ll)1000000);b=min(a-1,(ll)1000000);
		//cout << a << " " << b << "\n";
		bool yes=0;
		vector<pii> pos;
		for (ll j=1;j<=b;j++){
			for (ll k=j+1;k<=a;k++){
				if (k/j>mx && k*j>mx && k-j>mx && k+j>mx) continue;
				vector<ll> temp;
				vector<bool> vis(5,0);
				for (int l=0;l<5;l++){
					if (!vis[l] && (v[l]==k+j || v[l]==k-j || v[l]==k*j || v[l]==k/j || v[l]==k%j)){
						temp.push_back(l);vis[l]=1;
					}
				}
				if (temp.size()==5){
					pos.push_back({k,j});
				}
			}
		}
		if (pos.size()!=1) cout << 0 << " " << 0 << "\n";
		else cout << pos[0].first << " " << pos[0].second << "\n";
	}
	return 0;
}