#include "island.h"
#include <bits/stdc++.h>
using namespace std;
void solve(int N, int L) {
bool done[400];
for(int i = 0; i <= N; i++){
done[i] = false;
}
vector<int> v;
int inv[400];
inv[1] = -1;
for(int i = 1; i < N; i++){
v.push_back(query(1,i));
inv[v[i - 1]] = i - 1;
}
for(int i = 0; i < N - 1; i++){
if(done[i]) continue;
int cont = 1;
while(true){
int num = query(v[i],cont);
if(inv[num] < i){
answer(num,v[i]);
break;
}
else{
answer(num,v[i]);
done[inv[num]] = true;
}
cont++;
}
}
}
# |
결과 |
실행 시간 |
메모리 |
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 |
10 ms |
336 KB |
Output is correct |
6 |
Correct |
13 ms |
336 KB |
Output is correct |
7 |
Correct |
13 ms |
336 KB |
Output is correct |
8 |
Correct |
13 ms |
436 KB |
Output is correct |
9 |
Correct |
13 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
336 KB |
Output is correct |
2 |
Correct |
13 ms |
336 KB |
Output is correct |
3 |
Correct |
13 ms |
336 KB |
Output is correct |
4 |
Correct |
12 ms |
336 KB |
Output is correct |
5 |
Correct |
14 ms |
336 KB |
Output is correct |
6 |
Correct |
13 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
13 ms |
336 KB |
Output is correct |
3 |
Correct |
14 ms |
336 KB |
Output is correct |
4 |
Correct |
14 ms |
336 KB |
Output is correct |
5 |
Correct |
13 ms |
504 KB |
Output is correct |
6 |
Correct |
13 ms |
336 KB |
Output is correct |
7 |
Correct |
12 ms |
336 KB |
Output is correct |
8 |
Correct |
13 ms |
336 KB |
Output is correct |
9 |
Correct |
12 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
336 KB |
Output is correct |
2 |
Correct |
13 ms |
336 KB |
Output is correct |
3 |
Correct |
15 ms |
336 KB |
Output is correct |
4 |
Correct |
14 ms |
336 KB |
Output is correct |
5 |
Correct |
13 ms |
336 KB |
Output is correct |
6 |
Correct |
11 ms |
440 KB |
Output is correct |
7 |
Correct |
15 ms |
336 KB |
Output is correct |
8 |
Correct |
13 ms |
336 KB |
Output is correct |
9 |
Correct |
13 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 |
10 ms |
336 KB |
Output is correct |
6 |
Correct |
13 ms |
336 KB |
Output is correct |
7 |
Correct |
13 ms |
336 KB |
Output is correct |
8 |
Correct |
13 ms |
436 KB |
Output is correct |
9 |
Correct |
13 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
13 ms |
336 KB |
Output is correct |
12 |
Correct |
14 ms |
336 KB |
Output is correct |
13 |
Correct |
14 ms |
336 KB |
Output is correct |
14 |
Correct |
13 ms |
504 KB |
Output is correct |
15 |
Correct |
13 ms |
336 KB |
Output is correct |
16 |
Correct |
12 ms |
336 KB |
Output is correct |
17 |
Correct |
13 ms |
336 KB |
Output is correct |
18 |
Correct |
12 ms |
336 KB |
Output is correct |
19 |
Correct |
17 ms |
336 KB |
Output is correct |
20 |
Correct |
14 ms |
336 KB |
Output is correct |
21 |
Correct |
17 ms |
336 KB |
Output is correct |
22 |
Correct |
14 ms |
336 KB |
Output is correct |
23 |
Correct |
15 ms |
336 KB |
Output is correct |
24 |
Correct |
13 ms |
336 KB |
Output is correct |
25 |
Correct |
14 ms |
336 KB |
Output is correct |
26 |
Correct |
13 ms |
336 KB |
Output is correct |
27 |
Correct |
15 ms |
336 KB |
Output is correct |
28 |
Correct |
11 ms |
336 KB |
Output is correct |
29 |
Correct |
10 ms |
336 KB |
Output is correct |
30 |
Correct |
16 ms |
592 KB |
Output is correct |
31 |
Correct |
14 ms |
592 KB |
Output is correct |
32 |
Correct |
14 ms |
336 KB |
Output is correct |
33 |
Correct |
14 ms |
336 KB |
Output is correct |
34 |
Correct |
14 ms |
336 KB |
Output is correct |
35 |
Correct |
12 ms |
508 KB |
Output is correct |
36 |
Correct |
14 ms |
336 KB |
Output is correct |
37 |
Correct |
11 ms |
336 KB |
Output is correct |
38 |
Correct |
14 ms |
336 KB |
Output is correct |
39 |
Correct |
14 ms |
336 KB |
Output is correct |
40 |
Correct |
14 ms |
336 KB |
Output is correct |
41 |
Correct |
13 ms |
592 KB |
Output is correct |
42 |
Correct |
16 ms |
336 KB |
Output is correct |
43 |
Correct |
12 ms |
504 KB |
Output is correct |
44 |
Correct |
12 ms |
592 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 |
13 ms |
336 KB |
Output is correct |
5 |
Correct |
13 ms |
336 KB |
Output is correct |
6 |
Correct |
15 ms |
336 KB |
Output is correct |
7 |
Correct |
14 ms |
336 KB |
Output is correct |
8 |
Correct |
13 ms |
336 KB |
Output is correct |
9 |
Correct |
11 ms |
440 KB |
Output is correct |
10 |
Correct |
15 ms |
336 KB |
Output is correct |
11 |
Correct |
13 ms |
336 KB |
Output is correct |
12 |
Correct |
13 ms |
336 KB |
Output is correct |
13 |
Correct |
15 ms |
336 KB |
Output is correct |
14 |
Correct |
15 ms |
336 KB |
Output is correct |
15 |
Correct |
15 ms |
336 KB |
Output is correct |
16 |
Correct |
16 ms |
336 KB |
Output is correct |
17 |
Correct |
14 ms |
336 KB |
Output is correct |
18 |
Correct |
15 ms |
336 KB |
Output is correct |
19 |
Correct |
14 ms |
336 KB |
Output is correct |
20 |
Correct |
13 ms |
336 KB |
Output is correct |
21 |
Correct |
13 ms |
336 KB |
Output is correct |
22 |
Correct |
15 ms |
336 KB |
Output is correct |
23 |
Correct |
19 ms |
592 KB |
Output is correct |
24 |
Correct |
15 ms |
336 KB |
Output is correct |
25 |
Correct |
11 ms |
336 KB |
Output is correct |
26 |
Correct |
14 ms |
336 KB |
Output is correct |
27 |
Correct |
14 ms |
592 KB |
Output is correct |
28 |
Correct |
15 ms |
336 KB |
Output is correct |
29 |
Correct |
11 ms |
336 KB |
Output is correct |
30 |
Correct |
13 ms |
336 KB |
Output is correct |
31 |
Correct |
13 ms |
336 KB |
Output is correct |
32 |
Correct |
13 ms |
336 KB |
Output is correct |
33 |
Correct |
14 ms |
336 KB |
Output is correct |
34 |
Correct |
11 ms |
336 KB |
Output is correct |
35 |
Correct |
16 ms |
336 KB |
Output is correct |
36 |
Correct |
13 ms |
336 KB |
Output is correct |
37 |
Correct |
12 ms |
592 KB |
Output is correct |
38 |
Correct |
13 ms |
336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
14 ms |
336 KB |
Output is correct |
2 |
Correct |
13 ms |
336 KB |
Output is correct |
3 |
Correct |
13 ms |
336 KB |
Output is correct |
4 |
Correct |
12 ms |
336 KB |
Output is correct |
5 |
Correct |
14 ms |
336 KB |
Output is correct |
6 |
Correct |
13 ms |
336 KB |
Output is correct |
7 |
Correct |
13 ms |
336 KB |
Output is correct |
8 |
Correct |
13 ms |
336 KB |
Output is correct |
9 |
Correct |
13 ms |
336 KB |
Output is correct |
10 |
Correct |
14 ms |
336 KB |
Output is correct |
11 |
Correct |
11 ms |
336 KB |
Output is correct |
12 |
Correct |
12 ms |
336 KB |
Output is correct |
13 |
Correct |
12 ms |
336 KB |
Output is correct |
14 |
Correct |
13 ms |
336 KB |
Output is correct |
15 |
Correct |
15 ms |
336 KB |
Output is correct |
16 |
Correct |
17 ms |
336 KB |
Output is correct |
17 |
Correct |
14 ms |
336 KB |
Output is correct |
18 |
Correct |
12 ms |
336 KB |
Output is correct |
19 |
Correct |
12 ms |
504 KB |
Output is correct |
20 |
Correct |
13 ms |
336 KB |
Output is correct |
21 |
Correct |
10 ms |
336 KB |
Output is correct |
22 |
Correct |
12 ms |
336 KB |
Output is correct |
23 |
Correct |
14 ms |
336 KB |
Output is correct |
24 |
Correct |
14 ms |
336 KB |
Output is correct |
25 |
Correct |
15 ms |
336 KB |
Output is correct |
26 |
Correct |
12 ms |
336 KB |
Output is correct |
27 |
Correct |
15 ms |
336 KB |
Output is correct |
28 |
Correct |
10 ms |
336 KB |
Output is correct |
29 |
Correct |
13 ms |
336 KB |
Output is correct |
30 |
Correct |
15 ms |
336 KB |
Output is correct |
31 |
Correct |
11 ms |
592 KB |
Output is correct |
32 |
Correct |
11 ms |
336 KB |
Output is correct |
33 |
Correct |
13 ms |
592 KB |
Output is correct |
34 |
Correct |
14 ms |
336 KB |
Output is correct |
35 |
Correct |
14 ms |
336 KB |
Output is correct |
36 |
Correct |
16 ms |
336 KB |
Output is correct |
37 |
Correct |
10 ms |
336 KB |
Output is correct |
38 |
Correct |
13 ms |
592 KB |
Output is correct |
39 |
Correct |
12 ms |
608 KB |
Output is correct |
40 |
Correct |
15 ms |
336 KB |
Output is correct |