#include "island.h"
#include<algorithm>
#include<set>
#include<utility>
#include<vector>
using namespace std;
void solve(int N, int L) {
int n = N;
vector<int> ask1(n + 1);
for(int i = 2; i <= n; i++) ask1[i] = query(1, i - 1);
vector<int> p(n + 1, -1);
p[1] = 0;
p[ask1[2]] = 1;
for(int times = 3; times <= n; times++){
int now = ask1[times];
if(p[now] != -1) continue;
for(int i = 1; i < n; i++){
int res = query(now, i);
if(p[res] == -1){
p[res] = now;
}
else{
p[now] = res;
break;
}
}
}
for(int i = 2; i <= n; i++) answer(i, p[i]);
}
// g++ -std=c++17 -o run grader.cpp island.cpp -fsanitize=undefined -fsanitize=address -Wall -Wshadow -Wextra
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
7 ms |
336 KB |
Output is correct |
6 |
Correct |
6 ms |
336 KB |
Output is correct |
7 |
Correct |
9 ms |
336 KB |
Output is correct |
8 |
Correct |
6 ms |
592 KB |
Output is correct |
9 |
Correct |
6 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
336 KB |
Output is correct |
2 |
Correct |
6 ms |
336 KB |
Output is correct |
3 |
Correct |
7 ms |
592 KB |
Output is correct |
4 |
Correct |
6 ms |
592 KB |
Output is correct |
5 |
Correct |
6 ms |
336 KB |
Output is correct |
6 |
Correct |
8 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
8 ms |
592 KB |
Output is correct |
3 |
Correct |
6 ms |
336 KB |
Output is correct |
4 |
Correct |
8 ms |
336 KB |
Output is correct |
5 |
Correct |
6 ms |
336 KB |
Output is correct |
6 |
Correct |
8 ms |
592 KB |
Output is correct |
7 |
Correct |
5 ms |
336 KB |
Output is correct |
8 |
Correct |
6 ms |
424 KB |
Output is correct |
9 |
Correct |
7 ms |
592 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
336 KB |
Output is correct |
2 |
Correct |
7 ms |
336 KB |
Output is correct |
3 |
Correct |
6 ms |
336 KB |
Output is correct |
4 |
Correct |
7 ms |
336 KB |
Output is correct |
5 |
Correct |
6 ms |
336 KB |
Output is correct |
6 |
Correct |
6 ms |
508 KB |
Output is correct |
7 |
Correct |
7 ms |
504 KB |
Output is correct |
8 |
Correct |
7 ms |
428 KB |
Output is correct |
9 |
Correct |
7 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
7 ms |
336 KB |
Output is correct |
6 |
Correct |
6 ms |
336 KB |
Output is correct |
7 |
Correct |
9 ms |
336 KB |
Output is correct |
8 |
Correct |
6 ms |
592 KB |
Output is correct |
9 |
Correct |
6 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
8 ms |
592 KB |
Output is correct |
12 |
Correct |
6 ms |
336 KB |
Output is correct |
13 |
Correct |
8 ms |
336 KB |
Output is correct |
14 |
Correct |
6 ms |
336 KB |
Output is correct |
15 |
Correct |
8 ms |
592 KB |
Output is correct |
16 |
Correct |
5 ms |
336 KB |
Output is correct |
17 |
Correct |
6 ms |
424 KB |
Output is correct |
18 |
Correct |
7 ms |
592 KB |
Output is correct |
19 |
Correct |
6 ms |
336 KB |
Output is correct |
20 |
Correct |
7 ms |
336 KB |
Output is correct |
21 |
Correct |
6 ms |
336 KB |
Output is correct |
22 |
Correct |
8 ms |
604 KB |
Output is correct |
23 |
Correct |
7 ms |
336 KB |
Output is correct |
24 |
Correct |
6 ms |
336 KB |
Output is correct |
25 |
Correct |
7 ms |
336 KB |
Output is correct |
26 |
Correct |
5 ms |
592 KB |
Output is correct |
27 |
Correct |
6 ms |
336 KB |
Output is correct |
28 |
Correct |
6 ms |
600 KB |
Output is correct |
29 |
Correct |
6 ms |
428 KB |
Output is correct |
30 |
Correct |
7 ms |
504 KB |
Output is correct |
31 |
Correct |
6 ms |
424 KB |
Output is correct |
32 |
Correct |
6 ms |
336 KB |
Output is correct |
33 |
Correct |
6 ms |
336 KB |
Output is correct |
34 |
Correct |
6 ms |
336 KB |
Output is correct |
35 |
Correct |
6 ms |
336 KB |
Output is correct |
36 |
Correct |
6 ms |
336 KB |
Output is correct |
37 |
Correct |
8 ms |
336 KB |
Output is correct |
38 |
Correct |
5 ms |
336 KB |
Output is correct |
39 |
Correct |
6 ms |
336 KB |
Output is correct |
40 |
Correct |
7 ms |
504 KB |
Output is correct |
41 |
Correct |
8 ms |
336 KB |
Output is correct |
42 |
Correct |
7 ms |
424 KB |
Output is correct |
43 |
Correct |
6 ms |
336 KB |
Output is correct |
44 |
Correct |
6 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
5 ms |
336 KB |
Output is correct |
5 |
Correct |
7 ms |
336 KB |
Output is correct |
6 |
Correct |
6 ms |
336 KB |
Output is correct |
7 |
Correct |
7 ms |
336 KB |
Output is correct |
8 |
Correct |
6 ms |
336 KB |
Output is correct |
9 |
Correct |
6 ms |
508 KB |
Output is correct |
10 |
Correct |
7 ms |
504 KB |
Output is correct |
11 |
Correct |
7 ms |
428 KB |
Output is correct |
12 |
Correct |
7 ms |
336 KB |
Output is correct |
13 |
Correct |
6 ms |
336 KB |
Output is correct |
14 |
Correct |
7 ms |
336 KB |
Output is correct |
15 |
Correct |
7 ms |
336 KB |
Output is correct |
16 |
Correct |
6 ms |
336 KB |
Output is correct |
17 |
Correct |
7 ms |
336 KB |
Output is correct |
18 |
Correct |
6 ms |
336 KB |
Output is correct |
19 |
Correct |
6 ms |
336 KB |
Output is correct |
20 |
Correct |
7 ms |
592 KB |
Output is correct |
21 |
Correct |
10 ms |
428 KB |
Output is correct |
22 |
Correct |
6 ms |
336 KB |
Output is correct |
23 |
Correct |
6 ms |
336 KB |
Output is correct |
24 |
Correct |
6 ms |
436 KB |
Output is correct |
25 |
Correct |
6 ms |
336 KB |
Output is correct |
26 |
Correct |
7 ms |
336 KB |
Output is correct |
27 |
Correct |
6 ms |
336 KB |
Output is correct |
28 |
Correct |
6 ms |
336 KB |
Output is correct |
29 |
Correct |
9 ms |
432 KB |
Output is correct |
30 |
Correct |
7 ms |
336 KB |
Output is correct |
31 |
Correct |
6 ms |
336 KB |
Output is correct |
32 |
Correct |
7 ms |
504 KB |
Output is correct |
33 |
Correct |
8 ms |
348 KB |
Output is correct |
34 |
Correct |
7 ms |
336 KB |
Output is correct |
35 |
Correct |
6 ms |
336 KB |
Output is correct |
36 |
Correct |
7 ms |
336 KB |
Output is correct |
37 |
Correct |
7 ms |
336 KB |
Output is correct |
38 |
Correct |
7 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
336 KB |
Output is correct |
2 |
Correct |
6 ms |
336 KB |
Output is correct |
3 |
Correct |
7 ms |
592 KB |
Output is correct |
4 |
Correct |
6 ms |
592 KB |
Output is correct |
5 |
Correct |
6 ms |
336 KB |
Output is correct |
6 |
Correct |
8 ms |
336 KB |
Output is correct |
7 |
Correct |
6 ms |
428 KB |
Output is correct |
8 |
Correct |
6 ms |
336 KB |
Output is correct |
9 |
Correct |
5 ms |
336 KB |
Output is correct |
10 |
Correct |
6 ms |
424 KB |
Output is correct |
11 |
Correct |
5 ms |
336 KB |
Output is correct |
12 |
Correct |
7 ms |
336 KB |
Output is correct |
13 |
Correct |
6 ms |
336 KB |
Output is correct |
14 |
Correct |
7 ms |
388 KB |
Output is correct |
15 |
Correct |
5 ms |
336 KB |
Output is correct |
16 |
Correct |
6 ms |
420 KB |
Output is correct |
17 |
Correct |
6 ms |
336 KB |
Output is correct |
18 |
Correct |
8 ms |
336 KB |
Output is correct |
19 |
Correct |
6 ms |
336 KB |
Output is correct |
20 |
Correct |
8 ms |
336 KB |
Output is correct |
21 |
Correct |
6 ms |
336 KB |
Output is correct |
22 |
Correct |
8 ms |
428 KB |
Output is correct |
23 |
Correct |
6 ms |
336 KB |
Output is correct |
24 |
Correct |
8 ms |
336 KB |
Output is correct |
25 |
Correct |
6 ms |
336 KB |
Output is correct |
26 |
Correct |
8 ms |
592 KB |
Output is correct |
27 |
Correct |
7 ms |
336 KB |
Output is correct |
28 |
Correct |
7 ms |
336 KB |
Output is correct |
29 |
Correct |
6 ms |
336 KB |
Output is correct |
30 |
Correct |
6 ms |
384 KB |
Output is correct |
31 |
Correct |
7 ms |
336 KB |
Output is correct |
32 |
Correct |
7 ms |
420 KB |
Output is correct |
33 |
Correct |
7 ms |
592 KB |
Output is correct |
34 |
Correct |
8 ms |
336 KB |
Output is correct |
35 |
Correct |
8 ms |
508 KB |
Output is correct |
36 |
Correct |
7 ms |
336 KB |
Output is correct |
37 |
Correct |
9 ms |
592 KB |
Output is correct |
38 |
Correct |
6 ms |
336 KB |
Output is correct |
39 |
Correct |
6 ms |
336 KB |
Output is correct |
40 |
Correct |
6 ms |
508 KB |
Output is correct |