답안 #1052376

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1052376 2024-08-10T14:04:20 Z erray Island Hopping (JOI24_island) C++17
65 / 100
5 ms 856 KB
#include "island.h"
#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG 
  #include "/home/hp/contests/joi24scd4/debug.h"
#else 
  #define debug(...) void(37)
#endif

void solve(int N, int L) {
  /*
  int variable_example = query(1, 1);
  for (int i = 2; i <= N; i++) {
    answer(1, i);
  }
  */
  int root = 0;
  vector<int> ord;
  for (int i = 1; i < N; ++i) {
    ord.push_back(query(root + 1, i) - 1);
  }
  vector<int> ind(N, -1);
  for (int i = 0; i < N - 1; ++i) {
    ind[ord[i]] = i;
  }
  vector<int> par(N, -1);
  for (int i = N - 1; i > 0; --i) {
    if (par[i] == -1) {
      int v = i;
      int s = 0;
      do {
        par[v] = i;
        v = query(i + 1, ++s) - 1;
      } while (ind[v] > ind[i]);
      par[i] = v;
    }
    answer(i + 1, par[i] + 1);
  }
}

# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 4 ms 432 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
8 Correct 3 ms 440 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 340 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 3 ms 432 KB Output is correct
3 Correct 3 ms 596 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 4 ms 856 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 5 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB Output is correct
2 Correct 3 ms 440 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 3 ms 424 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
8 Correct 3 ms 344 KB Output is correct
9 Correct 4 ms 440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 4 ms 432 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
8 Correct 3 ms 440 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 3 ms 432 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 4 ms 344 KB Output is correct
15 Correct 4 ms 856 KB Output is correct
16 Correct 4 ms 344 KB Output is correct
17 Correct 4 ms 344 KB Output is correct
18 Correct 5 ms 344 KB Output is correct
19 Correct 3 ms 344 KB Output is correct
20 Correct 4 ms 432 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 3 ms 344 KB Output is correct
23 Correct 3 ms 344 KB Output is correct
24 Correct 3 ms 344 KB Output is correct
25 Correct 3 ms 344 KB Output is correct
26 Correct 3 ms 424 KB Output is correct
27 Correct 3 ms 344 KB Output is correct
28 Correct 3 ms 344 KB Output is correct
29 Correct 3 ms 344 KB Output is correct
30 Correct 3 ms 344 KB Output is correct
31 Correct 3 ms 344 KB Output is correct
32 Correct 3 ms 344 KB Output is correct
33 Correct 2 ms 344 KB Output is correct
34 Correct 4 ms 344 KB Output is correct
35 Correct 3 ms 344 KB Output is correct
36 Correct 4 ms 344 KB Output is correct
37 Correct 3 ms 344 KB Output is correct
38 Correct 3 ms 344 KB Output is correct
39 Correct 3 ms 344 KB Output is correct
40 Correct 2 ms 344 KB Output is correct
41 Correct 3 ms 432 KB Output is correct
42 Correct 3 ms 344 KB Output is correct
43 Correct 3 ms 344 KB Output is correct
44 Correct 4 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 3 ms 440 KB Output is correct
6 Correct 3 ms 344 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 3 ms 424 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 3 ms 344 KB Output is correct
12 Correct 4 ms 440 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 4 ms 344 KB Output is correct
15 Correct 5 ms 344 KB Output is correct
16 Correct 4 ms 344 KB Output is correct
17 Correct 3 ms 344 KB Output is correct
18 Correct 4 ms 344 KB Output is correct
19 Correct 5 ms 344 KB Output is correct
20 Correct 5 ms 344 KB Output is correct
21 Correct 3 ms 444 KB Output is correct
22 Correct 4 ms 344 KB Output is correct
23 Correct 4 ms 428 KB Output is correct
24 Correct 4 ms 344 KB Output is correct
25 Correct 5 ms 344 KB Output is correct
26 Correct 3 ms 444 KB Output is correct
27 Correct 5 ms 600 KB Output is correct
28 Correct 5 ms 344 KB Output is correct
29 Correct 3 ms 344 KB Output is correct
30 Correct 3 ms 428 KB Output is correct
31 Correct 3 ms 344 KB Output is correct
32 Correct 4 ms 344 KB Output is correct
33 Correct 4 ms 344 KB Output is correct
34 Correct 5 ms 600 KB Output is correct
35 Correct 3 ms 344 KB Output is correct
36 Correct 3 ms 344 KB Output is correct
37 Correct 2 ms 344 KB Output is correct
38 Correct 3 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 340 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -