-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2037B.cpp
More file actions
39 lines (31 loc) · 673 Bytes
/
Copy path2037B.cpp
File metadata and controls
39 lines (31 loc) · 673 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long
#define umap unordered_map
#define f(i, x, n) for (ll i = x; i < n; i++)
#define endl '\n'
#define optimize() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main() {
optimize();
ll t;
cin >> t;
while (t--) {
ll k, in; cin >> k;
ll tg = k-2;
map <ll, bool> mp;
f(i, 0, k) {
cin >> in;
if (tg%in==0 && mp.count(in)==0) {
mp[in] = true;
}
}
for (auto it : mp) {
if (tg % it.first == 0 && mp.count(tg/it.first) > 0) {
cout << it.first << " " << tg/it.first << endl;
break;
}
}
}
}