-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB_Intercepted_Inputs.cpp
More file actions
68 lines (68 loc) · 1.57 KB
/
B_Intercepted_Inputs.cpp
File metadata and controls
68 lines (68 loc) · 1.57 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*#include <bits/stdc++.h>
using namespace std;
int main() {
int tt;
cin >> tt;
while (tt--) {
int n;
cin >> n;
vector<int> a(n);
vector<int> cnt(n + 1);
for (int i = 0; i < n; i++) {
cin >> a[i];
cnt[a[i]] ++;
}
for (int x = 1; x <= n; x++) {
if (cnt[x] > 0 && (n - 2) % x == 0) {
if (cnt[(n - 2) / x] > 0) {
cout << x << " " << (n - 2) / x << endl;
break;
}
}
}
}
return 0;
}
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> v(n);
vector<int> hash(n + 1);
for (int i = 0; i < n; i++)
{
cin >> v[i];
hash[v[i]]++;
}
for (int i = 1; i <= n; i++)
{
if (hash[i] > 0 && ((n - 2) % i == 0))
{
int com = (n - 2) / i;
if (i == com)
{
if (hash[com] > 1)
{
cout << i << ' ' << com << endl;
break;
}
}
else
{
if (hash[com] > 0)
{
cout << i << ' ' << com << endl;
break;
}
}
}
}
}
}