답안 #630196

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
630196 2022-08-15T23:42:47 Z abeker 송신탑 (IOI22_towers) C++17
100 / 100
3430 ms 69788 KB
#include <bits/stdc++.h>
#include "towers.h"
using namespace std;

const int INF = INT_MAX;

class Orthogonal {
  int offset;
  vector <vector <int>> tour;
public:
  Orthogonal(vector <int> vals) {
    for (offset = 1; offset < vals.size(); offset *= 2);
    tour.resize(2 * offset);
    for (int i = 1; i < vals.size(); i++)
      tour[i + offset].push_back(vals[i]);
    for (int i = offset - 1; i; i--) {
      tour[i].resize(tour[2 * i].size() + tour[2 * i + 1].size());
      merge(tour[2 * i].begin(), tour[2 * i].end(), tour[2 * i + 1].begin(), tour[2 * i + 1].end(), tour[i].begin());
    }
  }
  Orthogonal() {}
  int query(int x, int lo, int hi, int from, int to, int val) {
    if (lo >= to || hi <= from)
      return 0;
    if (lo >= from && hi <= to)
      return lower_bound(tour[x].begin(), tour[x].end(), val) - tour[x].begin();
    int mid = (lo + hi) / 2;
    return query(2 * x, lo, mid, from, to, val) + query(2 * x + 1, mid, hi, from, to, val);
  }
  int query(int from, int to, int val) {
    return query(1, 0, offset, from, to, val);
  }
};

int N, lg;
vector <int> H;
vector <int> ex;
vector <int> lb, ub;
vector <vector <int>> mini;
vector <vector <int>> lft, rig;
Orthogonal count_lb, count_ub;

int query(int from, int to) {
  if (from >= to)
    return INF;
  int tmp = ex[to - from];
  return min(mini[from][tmp], mini[to - (1 << tmp)][tmp]);
}
void init(int n, vector <int> h) {
  N = n;
  H.resize(N + 2);
  H[0] = H[N + 1] = INF;
  for (int i = 1; i <= N; i++)
    H[i] = h[i - 1];
  while (1 << lg < N)
    lg++;
  mini.resize(N + 1, vector <int> (lg + 1));
  for (int i = 1; i <= N; i++)
    mini[i][0] = H[i];
  for (int j = 1; j <= lg; j++)
    for (int i = 1; i <= N; i++)
      mini[i][j] = min(mini[i][j - 1], i + (1 << j - 1) > N ? INF : mini[i + (1 << j - 1)][j - 1]);
  ex.resize(N + 1);
  for (int i = 2; i <= N; i++)
    ex[i] = ex[i / 2] + 1;
  lft.resize(N + 2, vector <int> (lg + 1));
  rig.resize(N + 2, vector <int> (lg + 1));
  stack <int> s;
  s.push(0);
  for (int i = 1; i <= N; i++) {
    while (H[s.top()] < H[i])
      s.pop();
    lft[i][0] = s.top();
    s.push(i);
  }
  s = stack <int> ();
  s.push(N + 1);
  for (int i = N; i; i--) {
    while (H[s.top()] < H[i])
      s.pop();
    rig[i][0] = s.top();
    s.push(i);
  }
  rig[N + 1] = vector <int> (lg + 1, N + 1);
  for (int j = 1; j <= lg; j++)
    for (int i = 1; i <= N; i++) {
      lft[i][j] = lft[lft[i][j - 1]][j - 1];
      rig[i][j] = rig[rig[i][j - 1]][j - 1];
    }
  lb.resize(N + 1);
  ub.resize(N + 1);
  for (int i = 1; i <= N; i++) {
    int tmp = query(lft[i][0] + 1, rig[i][0]);
    lb[i] = H[i] - tmp;
    ub[i] = min(H[lft[i][0]], H[rig[i][0]]) - tmp;
  }
  count_lb = Orthogonal(lb);
  count_ub = Orthogonal(ub);
}

int jump(int x, int k, const vector <vector <int>> &anc) {
  for (int i = 0; i <= lg; i++)
    if (k >> i & 1)
      x = anc[x][i];
  return x;
}

int max_towers(int l, int r, int d) {
  l += 1;
  r += 1;
  int smaller_lb = count_lb.query(l, r + 1, d);
  int smaller_ub = count_ub.query(l, r + 1, d);
  int lo = 0, hi = r - l + 1;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    int node = jump(l, mid, rig);
    if (rig[node][0] <= r && lb[node] < d)
      lo = mid + 1;
    else
      hi = mid;
  }
  smaller_lb -= lo;
  lo = 0, hi = r - l + 1;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    int node = jump(r, mid, lft);
    if (lft[node][0] >= l && lb[node] < d)
      lo = mid + 1;
    else
      hi = mid;
  }
  smaller_lb -= lo;
  lo = 0, hi = r - l + 1;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    int node = jump(l, mid, rig);
    if (rig[node][0] <= r && H[node] - query(l, rig[node][0]) < d)
      lo = mid + 1;
    else
      hi = mid;
  }
  smaller_lb += lo;
  lo = 0, hi = r - l + 1;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    int node = jump(r, mid, lft);
    if (lft[node][0] >= l && H[node] - query(lft[node][0] + 1, r + 1) < d)
      lo = mid + 1;
    else
      hi = mid;
  }
  smaller_lb += lo;
  lo = 0, hi = r - l + 1;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    int node = jump(l, mid, rig);
    if (rig[node][0] <= r && ub[node] < d)
      lo = mid + 1;
    else
      hi = mid;
  }
  smaller_ub -= lo;
  lo = 0, hi = r - l + 1;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    int node = jump(r, mid, lft);
    if (lft[node][0] >= l && ub[node] < d)
      lo = mid + 1;
    else
      hi = mid;
  }
  smaller_ub -= lo;
  lo = 0, hi = r - l + 1;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    int node = jump(l, mid, rig);
    if (rig[node][0] <= r && H[rig[node][0]] - query(l, rig[node][0]) < d)
      lo = mid + 1;
    else
      hi = mid;
  }
  smaller_ub += lo;
  lo = 0, hi = r - l + 1;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    int node = jump(r, mid, lft);
    if (lft[node][0] >= l && H[lft[node][0]] - query(lft[node][0] + 1, r + 1) < d)
      lo = mid + 1;
    else
      hi = mid;
  }
  smaller_ub += lo;
  lo = 0, hi = r - l + 1;
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    int node = jump(l, mid, rig);
    if (rig[node][0] <= r)
      lo = mid + 1;
    else
      hi = mid;
  }
  int arg_max = jump(l, lo, rig);
  smaller_lb -= lb[arg_max] < d;
  smaller_lb += H[arg_max] - query(l, r + 1) < d;
  smaller_ub -= ub[arg_max] < d;
  return smaller_lb - smaller_ub;
}

Compilation message

towers.cpp: In constructor 'Orthogonal::Orthogonal(std::vector<int>)':
towers.cpp:12:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for (offset = 1; offset < vals.size(); offset *= 2);
      |                      ~~~~~~~^~~~~~~~~~~~~
towers.cpp:14:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for (int i = 1; i < vals.size(); i++)
      |                     ~~^~~~~~~~~~~~~
towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:62:52: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   62 |       mini[i][j] = min(mini[i][j - 1], i + (1 << j - 1) > N ? INF : mini[i + (1 << j - 1)][j - 1]);
      |                                                  ~~^~~
towers.cpp:62:86: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   62 |       mini[i][j] = min(mini[i][j - 1], i + (1 << j - 1) > N ? INF : mini[i + (1 << j - 1)][j - 1]);
      |                                                                                    ~~^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1244 ms 39948 KB Output is correct
2 Correct 3173 ms 69648 KB Output is correct
3 Correct 3430 ms 69788 KB Output is correct
4 Correct 3376 ms 69784 KB Output is correct
5 Correct 3294 ms 69292 KB Output is correct
6 Correct 3177 ms 69736 KB Output is correct
7 Correct 2573 ms 69312 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 2 ms 1360 KB Output is correct
10 Correct 2 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 1360 KB Output is correct
3 Correct 2 ms 1368 KB Output is correct
4 Correct 2 ms 1364 KB Output is correct
5 Correct 2 ms 1360 KB Output is correct
6 Correct 2 ms 1360 KB Output is correct
7 Correct 2 ms 1360 KB Output is correct
8 Correct 2 ms 1360 KB Output is correct
9 Correct 2 ms 1360 KB Output is correct
10 Correct 2 ms 1360 KB Output is correct
11 Correct 2 ms 1360 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 1360 KB Output is correct
14 Correct 2 ms 1360 KB Output is correct
15 Correct 2 ms 1360 KB Output is correct
16 Correct 2 ms 1360 KB Output is correct
17 Correct 2 ms 1360 KB Output is correct
18 Correct 2 ms 1360 KB Output is correct
19 Correct 2 ms 1360 KB Output is correct
20 Correct 2 ms 1360 KB Output is correct
21 Correct 2 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 3 ms 1360 KB Output is correct
24 Correct 2 ms 1372 KB Output is correct
25 Correct 1 ms 732 KB Output is correct
26 Correct 2 ms 1372 KB Output is correct
27 Correct 2 ms 1372 KB Output is correct
28 Correct 2 ms 1372 KB Output is correct
29 Correct 2 ms 1372 KB Output is correct
30 Correct 2 ms 1372 KB Output is correct
31 Correct 2 ms 1372 KB Output is correct
32 Correct 2 ms 1372 KB Output is correct
33 Correct 2 ms 1360 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 1360 KB Output is correct
3 Correct 2 ms 1368 KB Output is correct
4 Correct 2 ms 1364 KB Output is correct
5 Correct 2 ms 1360 KB Output is correct
6 Correct 2 ms 1360 KB Output is correct
7 Correct 2 ms 1360 KB Output is correct
8 Correct 2 ms 1360 KB Output is correct
9 Correct 2 ms 1360 KB Output is correct
10 Correct 2 ms 1360 KB Output is correct
11 Correct 2 ms 1360 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 1360 KB Output is correct
14 Correct 2 ms 1360 KB Output is correct
15 Correct 2 ms 1360 KB Output is correct
16 Correct 2 ms 1360 KB Output is correct
17 Correct 2 ms 1360 KB Output is correct
18 Correct 2 ms 1360 KB Output is correct
19 Correct 2 ms 1360 KB Output is correct
20 Correct 2 ms 1360 KB Output is correct
21 Correct 2 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 3 ms 1360 KB Output is correct
24 Correct 2 ms 1372 KB Output is correct
25 Correct 1 ms 732 KB Output is correct
26 Correct 2 ms 1372 KB Output is correct
27 Correct 2 ms 1372 KB Output is correct
28 Correct 2 ms 1372 KB Output is correct
29 Correct 2 ms 1372 KB Output is correct
30 Correct 2 ms 1372 KB Output is correct
31 Correct 2 ms 1372 KB Output is correct
32 Correct 2 ms 1372 KB Output is correct
33 Correct 2 ms 1360 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
36 Correct 72 ms 42780 KB Output is correct
37 Correct 120 ms 69280 KB Output is correct
38 Correct 130 ms 69360 KB Output is correct
39 Correct 136 ms 69492 KB Output is correct
40 Correct 118 ms 69364 KB Output is correct
41 Correct 116 ms 69380 KB Output is correct
42 Correct 115 ms 69384 KB Output is correct
43 Correct 113 ms 69740 KB Output is correct
44 Correct 126 ms 69288 KB Output is correct
45 Correct 107 ms 69544 KB Output is correct
46 Correct 107 ms 69288 KB Output is correct
47 Correct 120 ms 69376 KB Output is correct
48 Correct 123 ms 69428 KB Output is correct
49 Correct 134 ms 69284 KB Output is correct
50 Correct 122 ms 69284 KB Output is correct
51 Correct 107 ms 69752 KB Output is correct
52 Correct 120 ms 69440 KB Output is correct
53 Correct 122 ms 69312 KB Output is correct
54 Correct 120 ms 69312 KB Output is correct
55 Correct 116 ms 69364 KB Output is correct
56 Correct 117 ms 69564 KB Output is correct
57 Correct 118 ms 67448 KB Output is correct
58 Correct 120 ms 69368 KB Output is correct
59 Correct 131 ms 69316 KB Output is correct
60 Correct 132 ms 69384 KB Output is correct
61 Correct 115 ms 69288 KB Output is correct
62 Correct 119 ms 69308 KB Output is correct
63 Correct 124 ms 69256 KB Output is correct
64 Correct 107 ms 69780 KB Output is correct
65 Correct 114 ms 69356 KB Output is correct
66 Correct 112 ms 69408 KB Output is correct
67 Correct 105 ms 69312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1834 ms 68936 KB Output is correct
2 Correct 2293 ms 69312 KB Output is correct
3 Correct 2179 ms 69384 KB Output is correct
4 Correct 2243 ms 69288 KB Output is correct
5 Correct 2160 ms 69420 KB Output is correct
6 Correct 2294 ms 69312 KB Output is correct
7 Correct 2106 ms 69348 KB Output is correct
8 Correct 2883 ms 69672 KB Output is correct
9 Correct 2170 ms 69360 KB Output is correct
10 Correct 2768 ms 69568 KB Output is correct
11 Correct 2632 ms 69376 KB Output is correct
12 Correct 2738 ms 69696 KB Output is correct
13 Correct 2328 ms 69396 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 2 ms 1360 KB Output is correct
16 Correct 2 ms 1364 KB Output is correct
17 Correct 124 ms 69372 KB Output is correct
18 Correct 114 ms 69380 KB Output is correct
19 Correct 118 ms 69296 KB Output is correct
20 Correct 111 ms 69272 KB Output is correct
21 Correct 106 ms 69772 KB Output is correct
22 Correct 118 ms 69372 KB Output is correct
23 Correct 124 ms 69440 KB Output is correct
24 Correct 115 ms 69356 KB Output is correct
25 Correct 109 ms 69372 KB Output is correct
26 Correct 106 ms 69496 KB Output is correct
27 Correct 2 ms 1360 KB Output is correct
28 Correct 2 ms 1360 KB Output is correct
29 Correct 2 ms 1360 KB Output is correct
30 Correct 2 ms 1360 KB Output is correct
31 Correct 3 ms 1360 KB Output is correct
32 Correct 2 ms 1360 KB Output is correct
33 Correct 2 ms 1360 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
36 Correct 2 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 535 ms 16552 KB Output is correct
2 Correct 1626 ms 69396 KB Output is correct
3 Correct 1947 ms 69324 KB Output is correct
4 Correct 1894 ms 69312 KB Output is correct
5 Correct 1784 ms 69352 KB Output is correct
6 Correct 1868 ms 69324 KB Output is correct
7 Correct 1899 ms 69368 KB Output is correct
8 Correct 2411 ms 69776 KB Output is correct
9 Correct 2147 ms 69272 KB Output is correct
10 Correct 1990 ms 69440 KB Output is correct
11 Correct 1858 ms 69268 KB Output is correct
12 Correct 126 ms 69368 KB Output is correct
13 Correct 122 ms 69268 KB Output is correct
14 Correct 116 ms 69376 KB Output is correct
15 Correct 111 ms 69316 KB Output is correct
16 Correct 107 ms 69496 KB Output is correct
17 Correct 116 ms 67452 KB Output is correct
18 Correct 120 ms 69288 KB Output is correct
19 Correct 119 ms 69300 KB Output is correct
20 Correct 116 ms 69372 KB Output is correct
21 Correct 121 ms 69380 KB Output is correct
22 Correct 123 ms 69268 KB Output is correct
23 Correct 118 ms 69312 KB Output is correct
24 Correct 112 ms 69720 KB Output is correct
25 Correct 115 ms 69360 KB Output is correct
26 Correct 106 ms 69440 KB Output is correct
27 Correct 114 ms 69264 KB Output is correct
28 Correct 2 ms 1360 KB Output is correct
29 Correct 2 ms 1360 KB Output is correct
30 Correct 2 ms 1360 KB Output is correct
31 Correct 2 ms 1360 KB Output is correct
32 Correct 2 ms 1360 KB Output is correct
33 Correct 1 ms 720 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1484 KB Output is correct
36 Correct 2 ms 1360 KB Output is correct
37 Correct 2 ms 1360 KB Output is correct
38 Correct 2 ms 1360 KB Output is correct
39 Correct 2 ms 1360 KB Output is correct
40 Correct 2 ms 1360 KB Output is correct
41 Correct 3 ms 1360 KB Output is correct
42 Correct 2 ms 1360 KB Output is correct
43 Correct 2 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 464 KB Output is correct
2 Correct 2 ms 1360 KB Output is correct
3 Correct 2 ms 1368 KB Output is correct
4 Correct 2 ms 1364 KB Output is correct
5 Correct 2 ms 1360 KB Output is correct
6 Correct 2 ms 1360 KB Output is correct
7 Correct 2 ms 1360 KB Output is correct
8 Correct 2 ms 1360 KB Output is correct
9 Correct 2 ms 1360 KB Output is correct
10 Correct 2 ms 1360 KB Output is correct
11 Correct 2 ms 1360 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 2 ms 1360 KB Output is correct
14 Correct 2 ms 1360 KB Output is correct
15 Correct 2 ms 1360 KB Output is correct
16 Correct 2 ms 1360 KB Output is correct
17 Correct 2 ms 1360 KB Output is correct
18 Correct 2 ms 1360 KB Output is correct
19 Correct 2 ms 1360 KB Output is correct
20 Correct 2 ms 1360 KB Output is correct
21 Correct 2 ms 1360 KB Output is correct
22 Correct 2 ms 1360 KB Output is correct
23 Correct 3 ms 1360 KB Output is correct
24 Correct 2 ms 1372 KB Output is correct
25 Correct 1 ms 732 KB Output is correct
26 Correct 2 ms 1372 KB Output is correct
27 Correct 2 ms 1372 KB Output is correct
28 Correct 2 ms 1372 KB Output is correct
29 Correct 2 ms 1372 KB Output is correct
30 Correct 2 ms 1372 KB Output is correct
31 Correct 2 ms 1372 KB Output is correct
32 Correct 2 ms 1372 KB Output is correct
33 Correct 2 ms 1360 KB Output is correct
34 Correct 2 ms 1360 KB Output is correct
35 Correct 2 ms 1360 KB Output is correct
36 Correct 72 ms 42780 KB Output is correct
37 Correct 120 ms 69280 KB Output is correct
38 Correct 130 ms 69360 KB Output is correct
39 Correct 136 ms 69492 KB Output is correct
40 Correct 118 ms 69364 KB Output is correct
41 Correct 116 ms 69380 KB Output is correct
42 Correct 115 ms 69384 KB Output is correct
43 Correct 113 ms 69740 KB Output is correct
44 Correct 126 ms 69288 KB Output is correct
45 Correct 107 ms 69544 KB Output is correct
46 Correct 107 ms 69288 KB Output is correct
47 Correct 120 ms 69376 KB Output is correct
48 Correct 123 ms 69428 KB Output is correct
49 Correct 134 ms 69284 KB Output is correct
50 Correct 122 ms 69284 KB Output is correct
51 Correct 107 ms 69752 KB Output is correct
52 Correct 120 ms 69440 KB Output is correct
53 Correct 122 ms 69312 KB Output is correct
54 Correct 120 ms 69312 KB Output is correct
55 Correct 116 ms 69364 KB Output is correct
56 Correct 117 ms 69564 KB Output is correct
57 Correct 118 ms 67448 KB Output is correct
58 Correct 120 ms 69368 KB Output is correct
59 Correct 131 ms 69316 KB Output is correct
60 Correct 132 ms 69384 KB Output is correct
61 Correct 115 ms 69288 KB Output is correct
62 Correct 119 ms 69308 KB Output is correct
63 Correct 124 ms 69256 KB Output is correct
64 Correct 107 ms 69780 KB Output is correct
65 Correct 114 ms 69356 KB Output is correct
66 Correct 112 ms 69408 KB Output is correct
67 Correct 105 ms 69312 KB Output is correct
68 Correct 1834 ms 68936 KB Output is correct
69 Correct 2293 ms 69312 KB Output is correct
70 Correct 2179 ms 69384 KB Output is correct
71 Correct 2243 ms 69288 KB Output is correct
72 Correct 2160 ms 69420 KB Output is correct
73 Correct 2294 ms 69312 KB Output is correct
74 Correct 2106 ms 69348 KB Output is correct
75 Correct 2883 ms 69672 KB Output is correct
76 Correct 2170 ms 69360 KB Output is correct
77 Correct 2768 ms 69568 KB Output is correct
78 Correct 2632 ms 69376 KB Output is correct
79 Correct 2738 ms 69696 KB Output is correct
80 Correct 2328 ms 69396 KB Output is correct
81 Correct 0 ms 208 KB Output is correct
82 Correct 2 ms 1360 KB Output is correct
83 Correct 2 ms 1364 KB Output is correct
84 Correct 124 ms 69372 KB Output is correct
85 Correct 114 ms 69380 KB Output is correct
86 Correct 118 ms 69296 KB Output is correct
87 Correct 111 ms 69272 KB Output is correct
88 Correct 106 ms 69772 KB Output is correct
89 Correct 118 ms 69372 KB Output is correct
90 Correct 124 ms 69440 KB Output is correct
91 Correct 115 ms 69356 KB Output is correct
92 Correct 109 ms 69372 KB Output is correct
93 Correct 106 ms 69496 KB Output is correct
94 Correct 2 ms 1360 KB Output is correct
95 Correct 2 ms 1360 KB Output is correct
96 Correct 2 ms 1360 KB Output is correct
97 Correct 2 ms 1360 KB Output is correct
98 Correct 3 ms 1360 KB Output is correct
99 Correct 2 ms 1360 KB Output is correct
100 Correct 2 ms 1360 KB Output is correct
101 Correct 2 ms 1360 KB Output is correct
102 Correct 2 ms 1360 KB Output is correct
103 Correct 2 ms 1360 KB Output is correct
104 Correct 1945 ms 62960 KB Output is correct
105 Correct 2202 ms 69312 KB Output is correct
106 Correct 2349 ms 69268 KB Output is correct
107 Correct 2294 ms 69308 KB Output is correct
108 Correct 2185 ms 69288 KB Output is correct
109 Correct 2332 ms 69344 KB Output is correct
110 Correct 2366 ms 69376 KB Output is correct
111 Correct 2796 ms 69780 KB Output is correct
112 Correct 2959 ms 69268 KB Output is correct
113 Correct 3165 ms 69436 KB Output is correct
114 Correct 3403 ms 69288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1244 ms 39948 KB Output is correct
2 Correct 3173 ms 69648 KB Output is correct
3 Correct 3430 ms 69788 KB Output is correct
4 Correct 3376 ms 69784 KB Output is correct
5 Correct 3294 ms 69292 KB Output is correct
6 Correct 3177 ms 69736 KB Output is correct
7 Correct 2573 ms 69312 KB Output is correct
8 Correct 0 ms 208 KB Output is correct
9 Correct 2 ms 1360 KB Output is correct
10 Correct 2 ms 1360 KB Output is correct
11 Correct 1 ms 464 KB Output is correct
12 Correct 2 ms 1360 KB Output is correct
13 Correct 2 ms 1368 KB Output is correct
14 Correct 2 ms 1364 KB Output is correct
15 Correct 2 ms 1360 KB Output is correct
16 Correct 2 ms 1360 KB Output is correct
17 Correct 2 ms 1360 KB Output is correct
18 Correct 2 ms 1360 KB Output is correct
19 Correct 2 ms 1360 KB Output is correct
20 Correct 2 ms 1360 KB Output is correct
21 Correct 2 ms 1360 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 2 ms 1360 KB Output is correct
24 Correct 2 ms 1360 KB Output is correct
25 Correct 2 ms 1360 KB Output is correct
26 Correct 2 ms 1360 KB Output is correct
27 Correct 2 ms 1360 KB Output is correct
28 Correct 2 ms 1360 KB Output is correct
29 Correct 2 ms 1360 KB Output is correct
30 Correct 2 ms 1360 KB Output is correct
31 Correct 2 ms 1360 KB Output is correct
32 Correct 2 ms 1360 KB Output is correct
33 Correct 3 ms 1360 KB Output is correct
34 Correct 2 ms 1372 KB Output is correct
35 Correct 1 ms 732 KB Output is correct
36 Correct 2 ms 1372 KB Output is correct
37 Correct 2 ms 1372 KB Output is correct
38 Correct 2 ms 1372 KB Output is correct
39 Correct 2 ms 1372 KB Output is correct
40 Correct 2 ms 1372 KB Output is correct
41 Correct 2 ms 1372 KB Output is correct
42 Correct 2 ms 1372 KB Output is correct
43 Correct 2 ms 1360 KB Output is correct
44 Correct 2 ms 1360 KB Output is correct
45 Correct 2 ms 1360 KB Output is correct
46 Correct 72 ms 42780 KB Output is correct
47 Correct 120 ms 69280 KB Output is correct
48 Correct 130 ms 69360 KB Output is correct
49 Correct 136 ms 69492 KB Output is correct
50 Correct 118 ms 69364 KB Output is correct
51 Correct 116 ms 69380 KB Output is correct
52 Correct 115 ms 69384 KB Output is correct
53 Correct 113 ms 69740 KB Output is correct
54 Correct 126 ms 69288 KB Output is correct
55 Correct 107 ms 69544 KB Output is correct
56 Correct 107 ms 69288 KB Output is correct
57 Correct 120 ms 69376 KB Output is correct
58 Correct 123 ms 69428 KB Output is correct
59 Correct 134 ms 69284 KB Output is correct
60 Correct 122 ms 69284 KB Output is correct
61 Correct 107 ms 69752 KB Output is correct
62 Correct 120 ms 69440 KB Output is correct
63 Correct 122 ms 69312 KB Output is correct
64 Correct 120 ms 69312 KB Output is correct
65 Correct 116 ms 69364 KB Output is correct
66 Correct 117 ms 69564 KB Output is correct
67 Correct 118 ms 67448 KB Output is correct
68 Correct 120 ms 69368 KB Output is correct
69 Correct 131 ms 69316 KB Output is correct
70 Correct 132 ms 69384 KB Output is correct
71 Correct 115 ms 69288 KB Output is correct
72 Correct 119 ms 69308 KB Output is correct
73 Correct 124 ms 69256 KB Output is correct
74 Correct 107 ms 69780 KB Output is correct
75 Correct 114 ms 69356 KB Output is correct
76 Correct 112 ms 69408 KB Output is correct
77 Correct 105 ms 69312 KB Output is correct
78 Correct 1834 ms 68936 KB Output is correct
79 Correct 2293 ms 69312 KB Output is correct
80 Correct 2179 ms 69384 KB Output is correct
81 Correct 2243 ms 69288 KB Output is correct
82 Correct 2160 ms 69420 KB Output is correct
83 Correct 2294 ms 69312 KB Output is correct
84 Correct 2106 ms 69348 KB Output is correct
85 Correct 2883 ms 69672 KB Output is correct
86 Correct 2170 ms 69360 KB Output is correct
87 Correct 2768 ms 69568 KB Output is correct
88 Correct 2632 ms 69376 KB Output is correct
89 Correct 2738 ms 69696 KB Output is correct
90 Correct 2328 ms 69396 KB Output is correct
91 Correct 0 ms 208 KB Output is correct
92 Correct 2 ms 1360 KB Output is correct
93 Correct 2 ms 1364 KB Output is correct
94 Correct 124 ms 69372 KB Output is correct
95 Correct 114 ms 69380 KB Output is correct
96 Correct 118 ms 69296 KB Output is correct
97 Correct 111 ms 69272 KB Output is correct
98 Correct 106 ms 69772 KB Output is correct
99 Correct 118 ms 69372 KB Output is correct
100 Correct 124 ms 69440 KB Output is correct
101 Correct 115 ms 69356 KB Output is correct
102 Correct 109 ms 69372 KB Output is correct
103 Correct 106 ms 69496 KB Output is correct
104 Correct 2 ms 1360 KB Output is correct
105 Correct 2 ms 1360 KB Output is correct
106 Correct 2 ms 1360 KB Output is correct
107 Correct 2 ms 1360 KB Output is correct
108 Correct 3 ms 1360 KB Output is correct
109 Correct 2 ms 1360 KB Output is correct
110 Correct 2 ms 1360 KB Output is correct
111 Correct 2 ms 1360 KB Output is correct
112 Correct 2 ms 1360 KB Output is correct
113 Correct 2 ms 1360 KB Output is correct
114 Correct 535 ms 16552 KB Output is correct
115 Correct 1626 ms 69396 KB Output is correct
116 Correct 1947 ms 69324 KB Output is correct
117 Correct 1894 ms 69312 KB Output is correct
118 Correct 1784 ms 69352 KB Output is correct
119 Correct 1868 ms 69324 KB Output is correct
120 Correct 1899 ms 69368 KB Output is correct
121 Correct 2411 ms 69776 KB Output is correct
122 Correct 2147 ms 69272 KB Output is correct
123 Correct 1990 ms 69440 KB Output is correct
124 Correct 1858 ms 69268 KB Output is correct
125 Correct 126 ms 69368 KB Output is correct
126 Correct 122 ms 69268 KB Output is correct
127 Correct 116 ms 69376 KB Output is correct
128 Correct 111 ms 69316 KB Output is correct
129 Correct 107 ms 69496 KB Output is correct
130 Correct 116 ms 67452 KB Output is correct
131 Correct 120 ms 69288 KB Output is correct
132 Correct 119 ms 69300 KB Output is correct
133 Correct 116 ms 69372 KB Output is correct
134 Correct 121 ms 69380 KB Output is correct
135 Correct 123 ms 69268 KB Output is correct
136 Correct 118 ms 69312 KB Output is correct
137 Correct 112 ms 69720 KB Output is correct
138 Correct 115 ms 69360 KB Output is correct
139 Correct 106 ms 69440 KB Output is correct
140 Correct 114 ms 69264 KB Output is correct
141 Correct 2 ms 1360 KB Output is correct
142 Correct 2 ms 1360 KB Output is correct
143 Correct 2 ms 1360 KB Output is correct
144 Correct 2 ms 1360 KB Output is correct
145 Correct 2 ms 1360 KB Output is correct
146 Correct 1 ms 720 KB Output is correct
147 Correct 2 ms 1360 KB Output is correct
148 Correct 2 ms 1484 KB Output is correct
149 Correct 2 ms 1360 KB Output is correct
150 Correct 2 ms 1360 KB Output is correct
151 Correct 2 ms 1360 KB Output is correct
152 Correct 2 ms 1360 KB Output is correct
153 Correct 2 ms 1360 KB Output is correct
154 Correct 3 ms 1360 KB Output is correct
155 Correct 2 ms 1360 KB Output is correct
156 Correct 2 ms 1360 KB Output is correct
157 Correct 1945 ms 62960 KB Output is correct
158 Correct 2202 ms 69312 KB Output is correct
159 Correct 2349 ms 69268 KB Output is correct
160 Correct 2294 ms 69308 KB Output is correct
161 Correct 2185 ms 69288 KB Output is correct
162 Correct 2332 ms 69344 KB Output is correct
163 Correct 2366 ms 69376 KB Output is correct
164 Correct 2796 ms 69780 KB Output is correct
165 Correct 2959 ms 69268 KB Output is correct
166 Correct 3165 ms 69436 KB Output is correct
167 Correct 3403 ms 69288 KB Output is correct
168 Correct 0 ms 208 KB Output is correct
169 Correct 1158 ms 25872 KB Output is correct
170 Correct 2581 ms 69312 KB Output is correct
171 Correct 2552 ms 69288 KB Output is correct
172 Correct 2573 ms 69364 KB Output is correct
173 Correct 2392 ms 69268 KB Output is correct
174 Correct 2354 ms 69312 KB Output is correct
175 Correct 2551 ms 69312 KB Output is correct
176 Correct 3298 ms 69784 KB Output is correct
177 Correct 3156 ms 69312 KB Output is correct
178 Correct 2876 ms 69316 KB Output is correct
179 Correct 3031 ms 69528 KB Output is correct