#include "island.h"
#include <bits/stdc++.h>
using namespace std;
void solve(int N, int L) {
vector<set<int>> adj(N+1);
vector<int> myMin(N+1);
for (int node = 1; node <= N; ++node) {
myMin[node] = query(node, 1);
adj[node].insert(myMin[node]);
adj[myMin[node]].insert(node);
}
for (int node = N; node >= 1; --node) {
set<int> bad = adj[myMin[node]];
for (int k = 2; k <= N-1; ++k) {
int voisin = query(node, k);
if (bad.count(voisin))
break;
adj[node].insert(voisin);
adj[voisin].insert(node);
for (int x : adj[voisin])
bad.insert(x);
}
}
for (int node = 1; node <= N; ++node) {
for (int voisin : adj[node]) if (node < voisin) {
answer(node, voisin);
}
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
6 ms |
892 KB |
Output is correct |
6 |
Correct |
5 ms |
600 KB |
Output is correct |
7 |
Correct |
5 ms |
856 KB |
Output is correct |
8 |
Correct |
5 ms |
600 KB |
Output is correct |
9 |
Correct |
5 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
600 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
6 ms |
880 KB |
Output is correct |
3 |
Correct |
5 ms |
600 KB |
Output is correct |
4 |
Correct |
5 ms |
636 KB |
Output is correct |
5 |
Correct |
5 ms |
852 KB |
Output is correct |
6 |
Correct |
5 ms |
600 KB |
Output is correct |
7 |
Correct |
5 ms |
1112 KB |
Output is correct |
8 |
Correct |
9 ms |
344 KB |
Output is correct |
9 |
Correct |
5 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
1108 KB |
Output is correct |
2 |
Correct |
9 ms |
1112 KB |
Output is correct |
3 |
Correct |
5 ms |
624 KB |
Output is correct |
4 |
Correct |
5 ms |
856 KB |
Output is correct |
5 |
Correct |
6 ms |
624 KB |
Output is correct |
6 |
Correct |
6 ms |
1012 KB |
Output is correct |
7 |
Correct |
5 ms |
600 KB |
Output is correct |
8 |
Correct |
5 ms |
600 KB |
Output is correct |
9 |
Correct |
4 ms |
624 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
6 ms |
892 KB |
Output is correct |
6 |
Correct |
5 ms |
600 KB |
Output is correct |
7 |
Correct |
5 ms |
856 KB |
Output is correct |
8 |
Correct |
5 ms |
600 KB |
Output is correct |
9 |
Correct |
5 ms |
600 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Correct |
6 ms |
880 KB |
Output is correct |
12 |
Correct |
5 ms |
600 KB |
Output is correct |
13 |
Correct |
5 ms |
636 KB |
Output is correct |
14 |
Correct |
5 ms |
852 KB |
Output is correct |
15 |
Correct |
5 ms |
600 KB |
Output is correct |
16 |
Correct |
5 ms |
1112 KB |
Output is correct |
17 |
Correct |
9 ms |
344 KB |
Output is correct |
18 |
Correct |
5 ms |
600 KB |
Output is correct |
19 |
Correct |
7 ms |
600 KB |
Output is correct |
20 |
Correct |
6 ms |
600 KB |
Output is correct |
21 |
Correct |
5 ms |
600 KB |
Output is correct |
22 |
Correct |
5 ms |
600 KB |
Output is correct |
23 |
Correct |
5 ms |
600 KB |
Output is correct |
24 |
Correct |
7 ms |
708 KB |
Output is correct |
25 |
Correct |
5 ms |
600 KB |
Output is correct |
26 |
Correct |
5 ms |
600 KB |
Output is correct |
27 |
Correct |
5 ms |
600 KB |
Output is correct |
28 |
Correct |
7 ms |
600 KB |
Output is correct |
29 |
Correct |
5 ms |
600 KB |
Output is correct |
30 |
Correct |
5 ms |
720 KB |
Output is correct |
31 |
Correct |
6 ms |
600 KB |
Output is correct |
32 |
Correct |
6 ms |
880 KB |
Output is correct |
33 |
Correct |
7 ms |
600 KB |
Output is correct |
34 |
Correct |
6 ms |
856 KB |
Output is correct |
35 |
Correct |
5 ms |
600 KB |
Output is correct |
36 |
Correct |
5 ms |
600 KB |
Output is correct |
37 |
Correct |
5 ms |
600 KB |
Output is correct |
38 |
Correct |
4 ms |
600 KB |
Output is correct |
39 |
Correct |
5 ms |
600 KB |
Output is correct |
40 |
Correct |
6 ms |
640 KB |
Output is correct |
41 |
Correct |
5 ms |
600 KB |
Output is correct |
42 |
Correct |
5 ms |
856 KB |
Output is correct |
43 |
Correct |
5 ms |
856 KB |
Output is correct |
44 |
Correct |
5 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
344 KB |
Output is correct |
4 |
Correct |
6 ms |
1108 KB |
Output is correct |
5 |
Correct |
9 ms |
1112 KB |
Output is correct |
6 |
Correct |
5 ms |
624 KB |
Output is correct |
7 |
Correct |
5 ms |
856 KB |
Output is correct |
8 |
Correct |
6 ms |
624 KB |
Output is correct |
9 |
Correct |
6 ms |
1012 KB |
Output is correct |
10 |
Correct |
5 ms |
600 KB |
Output is correct |
11 |
Correct |
5 ms |
600 KB |
Output is correct |
12 |
Correct |
4 ms |
624 KB |
Output is correct |
13 |
Correct |
5 ms |
600 KB |
Output is correct |
14 |
Correct |
5 ms |
880 KB |
Output is correct |
15 |
Correct |
6 ms |
600 KB |
Output is correct |
16 |
Correct |
5 ms |
600 KB |
Output is correct |
17 |
Correct |
5 ms |
1136 KB |
Output is correct |
18 |
Correct |
6 ms |
604 KB |
Output is correct |
19 |
Correct |
5 ms |
856 KB |
Output is correct |
20 |
Correct |
6 ms |
600 KB |
Output is correct |
21 |
Correct |
5 ms |
600 KB |
Output is correct |
22 |
Correct |
5 ms |
604 KB |
Output is correct |
23 |
Correct |
5 ms |
600 KB |
Output is correct |
24 |
Correct |
5 ms |
880 KB |
Output is correct |
25 |
Correct |
5 ms |
600 KB |
Output is correct |
26 |
Correct |
5 ms |
600 KB |
Output is correct |
27 |
Correct |
6 ms |
864 KB |
Output is correct |
28 |
Correct |
6 ms |
600 KB |
Output is correct |
29 |
Correct |
6 ms |
860 KB |
Output is correct |
30 |
Correct |
5 ms |
600 KB |
Output is correct |
31 |
Correct |
5 ms |
856 KB |
Output is correct |
32 |
Correct |
5 ms |
600 KB |
Output is correct |
33 |
Correct |
5 ms |
712 KB |
Output is correct |
34 |
Correct |
5 ms |
600 KB |
Output is correct |
35 |
Correct |
5 ms |
600 KB |
Output is correct |
36 |
Correct |
5 ms |
600 KB |
Output is correct |
37 |
Correct |
5 ms |
600 KB |
Output is correct |
38 |
Correct |
5 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
600 KB |
Wrong Answer [3] |
2 |
Halted |
0 ms |
0 KB |
- |