Submission #970656

# Submission time Handle Problem Language Result Execution time Memory
970656 2024-04-27T03:05:20 Z nguyentunglam Radio Towers (IOI22_towers) C++17
100 / 100
1294 ms 317476 KB
#include "towers.h"
#include<bits/stdc++.h>
#define all(v) v.begin(), v.end()
using namespace std;

const int N = 1e5 + 10, S = 1e5 * 20 * 4;

int h[N], lg[N], mx[20][N], mn[20][N], L[N], R[N];

int n;

vector<int> rrh, pos[2 * N];

int idx(int x) {
  return upper_bound(all(rrh), x) - rrh.begin();
}

struct ITSUM {
struct node {
  int left, right, val;
  node () {
    left = right = val = 0;
  }
} T[S];

int cnt;
int it[2 * N];

void pass (int x, int y) {
  T[it[x] = ++cnt] = T[it[y]];
}

void up(int s, int l, int r, int pos, int val) {
  if (l == r) {
    T[s].val += val;
    return;
  }
  int mid = l + r >> 1;
  if (pos <= mid) {
    T[++cnt] = T[T[s].left];
    T[s].left = cnt;
    up(T[s].left, l, mid, pos, val);
  }
  else {
    T[++cnt] = T[T[s].right];
    T[s].right = cnt;
    up(T[s].right, mid + 1, r, pos, val);
  }
  T[s].val = T[T[s].left].val + T[T[s].right].val;
}

int get(int s, int l, int r, int from, int to) {
  if (l > to || r < from || s == 0) return 0;
  if (from <= l && r <= to) return T[s].val;
  int mid = l + r >> 1;
  return get(T[s].left, l, mid, from, to) + get(T[s].right, mid + 1, r, from, to);
}
} itsum;

struct ITMAX {
struct node {
  int left, right, val;
  node () {
    left = right = 0;
    val = -1e9;
  }
} T[S];

int cnt;
int it[2 * N];

void pass (int x, int y) {
  T[it[x] = ++cnt] = T[it[y]];
}

void up(int s, int l, int r, int from , int to, int val) {
  if (l > to || r < from) return;
  if (from <= l && r <= to) {
    T[s].val = max(T[s].val, val);
    return;
  }
  int mid = l + r >> 1;
  T[++cnt] = T[T[s].left];
  T[s].left = cnt;
  T[++cnt] = T[T[s].right];
  T[s].right = cnt;
  up(T[s].left, l, mid, from, to, val);
  up(T[s].right, mid + 1, r, from, to, val);
}

int get(int s, int l, int r, int pos) {
//  cerr << s << " " << l << " " << r << endl;
  if (l == r || !s) return T[s].val;
  int mid = l + r >> 1;
//  cout << T[s].left << e
//  exit(0);
  if (pos <= mid) return max(T[s].val, get(T[s].left, l, mid, pos));
  return max(T[s].val, get(T[s].right, mid + 1, r, pos));
}
} itmax0, itmax1;

int getmax(int l, int r) {
  if (l > r) return -1e9;
  int k = lg[r - l + 1];
  return max(mx[k][l], mx[k][r - (1 << k) + 1]);
}

int best (int x, int y) {
  return h[x] < h[y] ? x : y;
}

int getmin(int l, int r) {
  if (l > r) return -1e9;
  int k = lg[r - l + 1];
  return best(mn[k][l], mn[k][r - (1 << k) + 1]);
}

priority_queue<int> Q[N];

bool alive[N];

void init(int N, std::vector<int> H) {
  n = N;
  for(int i = 0; i < n; i++) h[i] = H[i];
  stack<int> st;
  for(int i = 0; i < n; i++) {
    while (!st.empty() && h[st.top()] >= h[i]) st.pop();
    L[i] = st.empty() ? -1 : st.top();
    st.push(i);
  }
  while (!st.empty()) st.pop();
  for(int i = n - 1; i >= 0; i--) {
    while (!st.empty() && h[st.top()] >= h[i]) st.pop();
    R[i] = st.empty() ? n : st.top();
    st.push(i);
  }

  for(int i = 0; i < n; i++) mx[0][i] = h[i], mn[0][i] = i;
  for(int i = 2; i <= n; i++) lg[i] = lg[i / 2] + 1;
  for(int j = 1; j <= lg[n]; j++) for(int i = 0; i + (1 << j) - 1 < n; i++) {
    mx[j][i] = max(mx[j - 1][i], mx[j - 1][i + (1 << j - 1)]);
    mn[j][i] = best(mn[j - 1][i], mn[j - 1][i + (1 << j - 1)]);
  }

  for(int i = 0; i < n; i++) {
    int tmp = min(getmax(L[i] + 1, i - 1), getmax(i + 1, R[i] - 1)) - h[i];
    rrh.push_back(getmax(L[i] + 1, i - 1) - h[i]);
    rrh.push_back(getmax(i + 1, R[i] - 1) - h[i]);
  }

  sort(all(rrh));
  rrh.resize(unique(all(rrh)) - rrh.begin());

  int m = rrh.size();

  for(int i = 0; i < n; i++) {
    int tmp = min(getmax(L[i] + 1, i - 1), getmax(i + 1, R[i] - 1)) - h[i];
//    cout << getmax(L[i] + 1, i - 1) << " " << getmax(i + 1, R[i] - 1) << " " << i << endl;
    pos[idx(tmp)].push_back(i);
  }

  for(int val = m; val >= 1; val--) {
    itsum.pass(val, val + 1);
    for(int &i : pos[val]) {
      itsum.up(itsum.it[val], 0, n - 1, i, 1);
    } pos[val].clear();
  }

  for(int i = 0; i < n; i++) {
    int tmp = getmax(i + 1, R[i] - 1) - h[i];
//    cout << idx(tmp) << endl;
    pos[idx(tmp)].push_back(i);
  }

  for(int val = m; val >= 1; val--) {
    itmax0.pass(val, val + 1);
    for(int &i : pos[val]) {
      itmax0.up(itmax0.it[val], 0, n - 1, L[i] + 1, i, -i);
//      cout << itmax0.get(itmax0.it[val], 0, n - 1, i) << endl;
    } pos[val].clear();
  }

  for(int i = 0; i < n; i++) {
    int tmp = getmax(L[i] + 1, i - 1) - h[i];
    pos[idx(tmp)].push_back(i);
  }

  for(int val = m; val >= 1; val--) {
    itmax1.pass(val, val + 1);
    for(int &i : pos[val]) {
      itmax1.up(itmax1.it[val], 0, n - 1, i, R[i] - 1, i);
    }
  }
}

int max_towers(int l, int r, int d) {
  int tmp = idx(d - 1) + 1;

  int ans = itsum.get(itsum.it[tmp], 0, n - 1, l, r);

//  cout << ans << endl;
  int left = -itmax0.get(itmax0.it[tmp], 0, n - 1, l);
  int right = itmax1.get(itmax1.it[tmp], 0, n - 1, r);


  int smallest = getmin(l, r);
//  cout << smallest << " " << left << " " << right << endl;

  if (left >= l && left <= r && left != smallest && getmax(L[left] + 1, left - 1) - d < h[left]) {
    ans++;
  }
//  exit(0);

  if (right >= l && right <= r && right != smallest && getmax(right + 1, R[right] - 1) - d < h[right]) {
    ans++;
  }

  if (getmax(L[smallest] + 1, smallest - 1) - d < h[smallest] || getmax(smallest + 1, R[smallest] - 1) - d < h[smallest]) ans++;

  return ans;
}

#ifdef ngu
int main() {
  freopen ("task.inp", "r", stdin);
  freopen ("task.out", "w", stdout);
  int N, Q;
  assert(2 == scanf("%d %d", &N, &Q));
  std::vector<int> H(N);
  for (int i = 0; i < N; ++i) {
    assert(1 == scanf("%d", &H[i]));
  }
  init(N, H);

  for (int i = 0; i < Q; ++i) {
    int L, R, D;
    assert(3 == scanf("%d %d %d", &L, &R, &D));
    printf("%d\n", max_towers(L, R, D));
  }
  return 0;
}
#endif // ngu

Compilation message

towers.cpp: In member function 'void ITSUM::up(int, int, int, int, int)':
towers.cpp:38:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   38 |   int mid = l + r >> 1;
      |             ~~^~~
towers.cpp: In member function 'int ITSUM::get(int, int, int, int, int)':
towers.cpp:55:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   55 |   int mid = l + r >> 1;
      |             ~~^~~
towers.cpp: In member function 'void ITMAX::up(int, int, int, int, int, int)':
towers.cpp:82:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   82 |   int mid = l + r >> 1;
      |             ~~^~~
towers.cpp: In member function 'int ITMAX::get(int, int, int, int)':
towers.cpp:94:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   94 |   int mid = l + r >> 1;
      |             ~~^~~
towers.cpp: In function 'void init(int, std::vector<int>)':
towers.cpp:141:56: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
  141 |     mx[j][i] = max(mx[j - 1][i], mx[j - 1][i + (1 << j - 1)]);
      |                                                      ~~^~~
towers.cpp:142:57: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
  142 |     mn[j][i] = best(mn[j - 1][i], mn[j - 1][i + (1 << j - 1)]);
      |                                                       ~~^~~
towers.cpp:146:9: warning: unused variable 'tmp' [-Wunused-variable]
  146 |     int tmp = min(getmax(L[i] + 1, i - 1), getmax(i + 1, R[i] - 1)) - h[i];
      |         ^~~
# Verdict Execution time Memory Grader output
1 Correct 517 ms 305548 KB Output is correct
2 Correct 832 ms 314004 KB Output is correct
3 Correct 794 ms 314040 KB Output is correct
4 Correct 791 ms 314024 KB Output is correct
5 Correct 779 ms 314404 KB Output is correct
6 Correct 769 ms 313944 KB Output is correct
7 Correct 710 ms 314408 KB Output is correct
8 Correct 57 ms 293932 KB Output is correct
9 Correct 60 ms 294220 KB Output is correct
10 Correct 58 ms 294224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 293932 KB Output is correct
2 Correct 59 ms 294264 KB Output is correct
3 Correct 57 ms 294292 KB Output is correct
4 Correct 70 ms 294444 KB Output is correct
5 Correct 61 ms 294224 KB Output is correct
6 Correct 58 ms 294264 KB Output is correct
7 Correct 60 ms 294216 KB Output is correct
8 Correct 60 ms 294224 KB Output is correct
9 Correct 62 ms 294108 KB Output is correct
10 Correct 57 ms 294228 KB Output is correct
11 Correct 58 ms 294220 KB Output is correct
12 Correct 56 ms 293712 KB Output is correct
13 Correct 58 ms 294224 KB Output is correct
14 Correct 61 ms 294556 KB Output is correct
15 Correct 66 ms 294280 KB Output is correct
16 Correct 65 ms 304208 KB Output is correct
17 Correct 66 ms 304076 KB Output is correct
18 Correct 57 ms 304208 KB Output is correct
19 Correct 60 ms 304276 KB Output is correct
20 Correct 57 ms 304212 KB Output is correct
21 Correct 57 ms 304292 KB Output is correct
22 Correct 57 ms 304192 KB Output is correct
23 Correct 55 ms 304216 KB Output is correct
24 Correct 57 ms 304552 KB Output is correct
25 Correct 56 ms 304180 KB Output is correct
26 Correct 57 ms 304336 KB Output is correct
27 Correct 57 ms 304256 KB Output is correct
28 Correct 59 ms 304208 KB Output is correct
29 Correct 58 ms 304208 KB Output is correct
30 Correct 58 ms 304208 KB Output is correct
31 Correct 58 ms 304292 KB Output is correct
32 Correct 56 ms 304128 KB Output is correct
33 Correct 56 ms 304252 KB Output is correct
34 Correct 57 ms 304208 KB Output is correct
35 Correct 56 ms 304148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 293932 KB Output is correct
2 Correct 59 ms 294264 KB Output is correct
3 Correct 57 ms 294292 KB Output is correct
4 Correct 70 ms 294444 KB Output is correct
5 Correct 61 ms 294224 KB Output is correct
6 Correct 58 ms 294264 KB Output is correct
7 Correct 60 ms 294216 KB Output is correct
8 Correct 60 ms 294224 KB Output is correct
9 Correct 62 ms 294108 KB Output is correct
10 Correct 57 ms 294228 KB Output is correct
11 Correct 58 ms 294220 KB Output is correct
12 Correct 56 ms 293712 KB Output is correct
13 Correct 58 ms 294224 KB Output is correct
14 Correct 61 ms 294556 KB Output is correct
15 Correct 66 ms 294280 KB Output is correct
16 Correct 65 ms 304208 KB Output is correct
17 Correct 66 ms 304076 KB Output is correct
18 Correct 57 ms 304208 KB Output is correct
19 Correct 60 ms 304276 KB Output is correct
20 Correct 57 ms 304212 KB Output is correct
21 Correct 57 ms 304292 KB Output is correct
22 Correct 57 ms 304192 KB Output is correct
23 Correct 55 ms 304216 KB Output is correct
24 Correct 57 ms 304552 KB Output is correct
25 Correct 56 ms 304180 KB Output is correct
26 Correct 57 ms 304336 KB Output is correct
27 Correct 57 ms 304256 KB Output is correct
28 Correct 59 ms 304208 KB Output is correct
29 Correct 58 ms 304208 KB Output is correct
30 Correct 58 ms 304208 KB Output is correct
31 Correct 58 ms 304292 KB Output is correct
32 Correct 56 ms 304128 KB Output is correct
33 Correct 56 ms 304252 KB Output is correct
34 Correct 57 ms 304208 KB Output is correct
35 Correct 56 ms 304148 KB Output is correct
36 Correct 158 ms 313148 KB Output is correct
37 Correct 244 ms 315688 KB Output is correct
38 Correct 233 ms 315868 KB Output is correct
39 Correct 231 ms 315172 KB Output is correct
40 Correct 230 ms 315280 KB Output is correct
41 Correct 233 ms 315328 KB Output is correct
42 Correct 250 ms 315344 KB Output is correct
43 Correct 141 ms 316844 KB Output is correct
44 Correct 138 ms 317268 KB Output is correct
45 Correct 141 ms 316712 KB Output is correct
46 Correct 143 ms 316980 KB Output is correct
47 Correct 236 ms 315684 KB Output is correct
48 Correct 231 ms 315168 KB Output is correct
49 Correct 244 ms 315432 KB Output is correct
50 Correct 134 ms 317268 KB Output is correct
51 Correct 140 ms 316684 KB Output is correct
52 Correct 257 ms 315640 KB Output is correct
53 Correct 231 ms 315176 KB Output is correct
54 Correct 244 ms 315168 KB Output is correct
55 Correct 141 ms 317272 KB Output is correct
56 Correct 141 ms 316680 KB Output is correct
57 Correct 226 ms 315412 KB Output is correct
58 Correct 252 ms 316068 KB Output is correct
59 Correct 258 ms 315844 KB Output is correct
60 Correct 238 ms 315332 KB Output is correct
61 Correct 226 ms 315172 KB Output is correct
62 Correct 241 ms 315172 KB Output is correct
63 Correct 256 ms 315604 KB Output is correct
64 Correct 137 ms 316836 KB Output is correct
65 Correct 133 ms 317224 KB Output is correct
66 Correct 142 ms 317220 KB Output is correct
67 Correct 135 ms 317052 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 818 ms 315684 KB Output is correct
2 Correct 950 ms 315844 KB Output is correct
3 Correct 1002 ms 315868 KB Output is correct
4 Correct 1024 ms 315172 KB Output is correct
5 Correct 971 ms 315176 KB Output is correct
6 Correct 977 ms 315176 KB Output is correct
7 Correct 935 ms 315328 KB Output is correct
8 Correct 768 ms 316844 KB Output is correct
9 Correct 749 ms 317476 KB Output is correct
10 Correct 769 ms 316920 KB Output is correct
11 Correct 797 ms 317028 KB Output is correct
12 Correct 766 ms 316840 KB Output is correct
13 Correct 786 ms 317216 KB Output is correct
14 Correct 56 ms 297988 KB Output is correct
15 Correct 57 ms 304204 KB Output is correct
16 Correct 57 ms 304136 KB Output is correct
17 Correct 252 ms 315844 KB Output is correct
18 Correct 235 ms 315132 KB Output is correct
19 Correct 247 ms 315400 KB Output is correct
20 Correct 137 ms 317328 KB Output is correct
21 Correct 134 ms 316840 KB Output is correct
22 Correct 246 ms 315960 KB Output is correct
23 Correct 238 ms 315172 KB Output is correct
24 Correct 250 ms 315332 KB Output is correct
25 Correct 136 ms 317224 KB Output is correct
26 Correct 143 ms 316748 KB Output is correct
27 Correct 57 ms 304212 KB Output is correct
28 Correct 59 ms 304244 KB Output is correct
29 Correct 57 ms 304208 KB Output is correct
30 Correct 56 ms 304188 KB Output is correct
31 Correct 57 ms 304204 KB Output is correct
32 Correct 56 ms 304192 KB Output is correct
33 Correct 59 ms 304208 KB Output is correct
34 Correct 57 ms 304208 KB Output is correct
35 Correct 57 ms 304208 KB Output is correct
36 Correct 55 ms 304208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 283 ms 309900 KB Output is correct
2 Correct 946 ms 315688 KB Output is correct
3 Correct 938 ms 315684 KB Output is correct
4 Correct 924 ms 315180 KB Output is correct
5 Correct 947 ms 315176 KB Output is correct
6 Correct 943 ms 315780 KB Output is correct
7 Correct 884 ms 315344 KB Output is correct
8 Correct 748 ms 316840 KB Output is correct
9 Correct 716 ms 317216 KB Output is correct
10 Correct 730 ms 316960 KB Output is correct
11 Correct 784 ms 316840 KB Output is correct
12 Correct 237 ms 315624 KB Output is correct
13 Correct 235 ms 315308 KB Output is correct
14 Correct 237 ms 315168 KB Output is correct
15 Correct 137 ms 317216 KB Output is correct
16 Correct 144 ms 316916 KB Output is correct
17 Correct 236 ms 315416 KB Output is correct
18 Correct 246 ms 315684 KB Output is correct
19 Correct 265 ms 315844 KB Output is correct
20 Correct 229 ms 315168 KB Output is correct
21 Correct 232 ms 315172 KB Output is correct
22 Correct 244 ms 315172 KB Output is correct
23 Correct 228 ms 315308 KB Output is correct
24 Correct 133 ms 316792 KB Output is correct
25 Correct 132 ms 317216 KB Output is correct
26 Correct 145 ms 316868 KB Output is correct
27 Correct 133 ms 317108 KB Output is correct
28 Correct 58 ms 304208 KB Output is correct
29 Correct 58 ms 304208 KB Output is correct
30 Correct 61 ms 304124 KB Output is correct
31 Correct 56 ms 304232 KB Output is correct
32 Correct 57 ms 304124 KB Output is correct
33 Correct 56 ms 304076 KB Output is correct
34 Correct 64 ms 304208 KB Output is correct
35 Correct 57 ms 304208 KB Output is correct
36 Correct 58 ms 304244 KB Output is correct
37 Correct 57 ms 304208 KB Output is correct
38 Correct 56 ms 304232 KB Output is correct
39 Correct 57 ms 304208 KB Output is correct
40 Correct 56 ms 304148 KB Output is correct
41 Correct 57 ms 304208 KB Output is correct
42 Correct 57 ms 304360 KB Output is correct
43 Correct 65 ms 304220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 293932 KB Output is correct
2 Correct 59 ms 294264 KB Output is correct
3 Correct 57 ms 294292 KB Output is correct
4 Correct 70 ms 294444 KB Output is correct
5 Correct 61 ms 294224 KB Output is correct
6 Correct 58 ms 294264 KB Output is correct
7 Correct 60 ms 294216 KB Output is correct
8 Correct 60 ms 294224 KB Output is correct
9 Correct 62 ms 294108 KB Output is correct
10 Correct 57 ms 294228 KB Output is correct
11 Correct 58 ms 294220 KB Output is correct
12 Correct 56 ms 293712 KB Output is correct
13 Correct 58 ms 294224 KB Output is correct
14 Correct 61 ms 294556 KB Output is correct
15 Correct 66 ms 294280 KB Output is correct
16 Correct 65 ms 304208 KB Output is correct
17 Correct 66 ms 304076 KB Output is correct
18 Correct 57 ms 304208 KB Output is correct
19 Correct 60 ms 304276 KB Output is correct
20 Correct 57 ms 304212 KB Output is correct
21 Correct 57 ms 304292 KB Output is correct
22 Correct 57 ms 304192 KB Output is correct
23 Correct 55 ms 304216 KB Output is correct
24 Correct 57 ms 304552 KB Output is correct
25 Correct 56 ms 304180 KB Output is correct
26 Correct 57 ms 304336 KB Output is correct
27 Correct 57 ms 304256 KB Output is correct
28 Correct 59 ms 304208 KB Output is correct
29 Correct 58 ms 304208 KB Output is correct
30 Correct 58 ms 304208 KB Output is correct
31 Correct 58 ms 304292 KB Output is correct
32 Correct 56 ms 304128 KB Output is correct
33 Correct 56 ms 304252 KB Output is correct
34 Correct 57 ms 304208 KB Output is correct
35 Correct 56 ms 304148 KB Output is correct
36 Correct 158 ms 313148 KB Output is correct
37 Correct 244 ms 315688 KB Output is correct
38 Correct 233 ms 315868 KB Output is correct
39 Correct 231 ms 315172 KB Output is correct
40 Correct 230 ms 315280 KB Output is correct
41 Correct 233 ms 315328 KB Output is correct
42 Correct 250 ms 315344 KB Output is correct
43 Correct 141 ms 316844 KB Output is correct
44 Correct 138 ms 317268 KB Output is correct
45 Correct 141 ms 316712 KB Output is correct
46 Correct 143 ms 316980 KB Output is correct
47 Correct 236 ms 315684 KB Output is correct
48 Correct 231 ms 315168 KB Output is correct
49 Correct 244 ms 315432 KB Output is correct
50 Correct 134 ms 317268 KB Output is correct
51 Correct 140 ms 316684 KB Output is correct
52 Correct 257 ms 315640 KB Output is correct
53 Correct 231 ms 315176 KB Output is correct
54 Correct 244 ms 315168 KB Output is correct
55 Correct 141 ms 317272 KB Output is correct
56 Correct 141 ms 316680 KB Output is correct
57 Correct 226 ms 315412 KB Output is correct
58 Correct 252 ms 316068 KB Output is correct
59 Correct 258 ms 315844 KB Output is correct
60 Correct 238 ms 315332 KB Output is correct
61 Correct 226 ms 315172 KB Output is correct
62 Correct 241 ms 315172 KB Output is correct
63 Correct 256 ms 315604 KB Output is correct
64 Correct 137 ms 316836 KB Output is correct
65 Correct 133 ms 317224 KB Output is correct
66 Correct 142 ms 317220 KB Output is correct
67 Correct 135 ms 317052 KB Output is correct
68 Correct 818 ms 315684 KB Output is correct
69 Correct 950 ms 315844 KB Output is correct
70 Correct 1002 ms 315868 KB Output is correct
71 Correct 1024 ms 315172 KB Output is correct
72 Correct 971 ms 315176 KB Output is correct
73 Correct 977 ms 315176 KB Output is correct
74 Correct 935 ms 315328 KB Output is correct
75 Correct 768 ms 316844 KB Output is correct
76 Correct 749 ms 317476 KB Output is correct
77 Correct 769 ms 316920 KB Output is correct
78 Correct 797 ms 317028 KB Output is correct
79 Correct 766 ms 316840 KB Output is correct
80 Correct 786 ms 317216 KB Output is correct
81 Correct 56 ms 297988 KB Output is correct
82 Correct 57 ms 304204 KB Output is correct
83 Correct 57 ms 304136 KB Output is correct
84 Correct 252 ms 315844 KB Output is correct
85 Correct 235 ms 315132 KB Output is correct
86 Correct 247 ms 315400 KB Output is correct
87 Correct 137 ms 317328 KB Output is correct
88 Correct 134 ms 316840 KB Output is correct
89 Correct 246 ms 315960 KB Output is correct
90 Correct 238 ms 315172 KB Output is correct
91 Correct 250 ms 315332 KB Output is correct
92 Correct 136 ms 317224 KB Output is correct
93 Correct 143 ms 316748 KB Output is correct
94 Correct 57 ms 304212 KB Output is correct
95 Correct 59 ms 304244 KB Output is correct
96 Correct 57 ms 304208 KB Output is correct
97 Correct 56 ms 304188 KB Output is correct
98 Correct 57 ms 304204 KB Output is correct
99 Correct 56 ms 304192 KB Output is correct
100 Correct 59 ms 304208 KB Output is correct
101 Correct 57 ms 304208 KB Output is correct
102 Correct 57 ms 304208 KB Output is correct
103 Correct 55 ms 304208 KB Output is correct
104 Correct 830 ms 315024 KB Output is correct
105 Correct 980 ms 315688 KB Output is correct
106 Correct 963 ms 315960 KB Output is correct
107 Correct 986 ms 315176 KB Output is correct
108 Correct 914 ms 315552 KB Output is correct
109 Correct 976 ms 315324 KB Output is correct
110 Correct 992 ms 315388 KB Output is correct
111 Correct 690 ms 316844 KB Output is correct
112 Correct 731 ms 317332 KB Output is correct
113 Correct 749 ms 316868 KB Output is correct
114 Correct 743 ms 316960 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 517 ms 305548 KB Output is correct
2 Correct 832 ms 314004 KB Output is correct
3 Correct 794 ms 314040 KB Output is correct
4 Correct 791 ms 314024 KB Output is correct
5 Correct 779 ms 314404 KB Output is correct
6 Correct 769 ms 313944 KB Output is correct
7 Correct 710 ms 314408 KB Output is correct
8 Correct 57 ms 293932 KB Output is correct
9 Correct 60 ms 294220 KB Output is correct
10 Correct 58 ms 294224 KB Output is correct
11 Correct 56 ms 293932 KB Output is correct
12 Correct 59 ms 294264 KB Output is correct
13 Correct 57 ms 294292 KB Output is correct
14 Correct 70 ms 294444 KB Output is correct
15 Correct 61 ms 294224 KB Output is correct
16 Correct 58 ms 294264 KB Output is correct
17 Correct 60 ms 294216 KB Output is correct
18 Correct 60 ms 294224 KB Output is correct
19 Correct 62 ms 294108 KB Output is correct
20 Correct 57 ms 294228 KB Output is correct
21 Correct 58 ms 294220 KB Output is correct
22 Correct 56 ms 293712 KB Output is correct
23 Correct 58 ms 294224 KB Output is correct
24 Correct 61 ms 294556 KB Output is correct
25 Correct 66 ms 294280 KB Output is correct
26 Correct 65 ms 304208 KB Output is correct
27 Correct 66 ms 304076 KB Output is correct
28 Correct 57 ms 304208 KB Output is correct
29 Correct 60 ms 304276 KB Output is correct
30 Correct 57 ms 304212 KB Output is correct
31 Correct 57 ms 304292 KB Output is correct
32 Correct 57 ms 304192 KB Output is correct
33 Correct 55 ms 304216 KB Output is correct
34 Correct 57 ms 304552 KB Output is correct
35 Correct 56 ms 304180 KB Output is correct
36 Correct 57 ms 304336 KB Output is correct
37 Correct 57 ms 304256 KB Output is correct
38 Correct 59 ms 304208 KB Output is correct
39 Correct 58 ms 304208 KB Output is correct
40 Correct 58 ms 304208 KB Output is correct
41 Correct 58 ms 304292 KB Output is correct
42 Correct 56 ms 304128 KB Output is correct
43 Correct 56 ms 304252 KB Output is correct
44 Correct 57 ms 304208 KB Output is correct
45 Correct 56 ms 304148 KB Output is correct
46 Correct 158 ms 313148 KB Output is correct
47 Correct 244 ms 315688 KB Output is correct
48 Correct 233 ms 315868 KB Output is correct
49 Correct 231 ms 315172 KB Output is correct
50 Correct 230 ms 315280 KB Output is correct
51 Correct 233 ms 315328 KB Output is correct
52 Correct 250 ms 315344 KB Output is correct
53 Correct 141 ms 316844 KB Output is correct
54 Correct 138 ms 317268 KB Output is correct
55 Correct 141 ms 316712 KB Output is correct
56 Correct 143 ms 316980 KB Output is correct
57 Correct 236 ms 315684 KB Output is correct
58 Correct 231 ms 315168 KB Output is correct
59 Correct 244 ms 315432 KB Output is correct
60 Correct 134 ms 317268 KB Output is correct
61 Correct 140 ms 316684 KB Output is correct
62 Correct 257 ms 315640 KB Output is correct
63 Correct 231 ms 315176 KB Output is correct
64 Correct 244 ms 315168 KB Output is correct
65 Correct 141 ms 317272 KB Output is correct
66 Correct 141 ms 316680 KB Output is correct
67 Correct 226 ms 315412 KB Output is correct
68 Correct 252 ms 316068 KB Output is correct
69 Correct 258 ms 315844 KB Output is correct
70 Correct 238 ms 315332 KB Output is correct
71 Correct 226 ms 315172 KB Output is correct
72 Correct 241 ms 315172 KB Output is correct
73 Correct 256 ms 315604 KB Output is correct
74 Correct 137 ms 316836 KB Output is correct
75 Correct 133 ms 317224 KB Output is correct
76 Correct 142 ms 317220 KB Output is correct
77 Correct 135 ms 317052 KB Output is correct
78 Correct 818 ms 315684 KB Output is correct
79 Correct 950 ms 315844 KB Output is correct
80 Correct 1002 ms 315868 KB Output is correct
81 Correct 1024 ms 315172 KB Output is correct
82 Correct 971 ms 315176 KB Output is correct
83 Correct 977 ms 315176 KB Output is correct
84 Correct 935 ms 315328 KB Output is correct
85 Correct 768 ms 316844 KB Output is correct
86 Correct 749 ms 317476 KB Output is correct
87 Correct 769 ms 316920 KB Output is correct
88 Correct 797 ms 317028 KB Output is correct
89 Correct 766 ms 316840 KB Output is correct
90 Correct 786 ms 317216 KB Output is correct
91 Correct 56 ms 297988 KB Output is correct
92 Correct 57 ms 304204 KB Output is correct
93 Correct 57 ms 304136 KB Output is correct
94 Correct 252 ms 315844 KB Output is correct
95 Correct 235 ms 315132 KB Output is correct
96 Correct 247 ms 315400 KB Output is correct
97 Correct 137 ms 317328 KB Output is correct
98 Correct 134 ms 316840 KB Output is correct
99 Correct 246 ms 315960 KB Output is correct
100 Correct 238 ms 315172 KB Output is correct
101 Correct 250 ms 315332 KB Output is correct
102 Correct 136 ms 317224 KB Output is correct
103 Correct 143 ms 316748 KB Output is correct
104 Correct 57 ms 304212 KB Output is correct
105 Correct 59 ms 304244 KB Output is correct
106 Correct 57 ms 304208 KB Output is correct
107 Correct 56 ms 304188 KB Output is correct
108 Correct 57 ms 304204 KB Output is correct
109 Correct 56 ms 304192 KB Output is correct
110 Correct 59 ms 304208 KB Output is correct
111 Correct 57 ms 304208 KB Output is correct
112 Correct 57 ms 304208 KB Output is correct
113 Correct 55 ms 304208 KB Output is correct
114 Correct 283 ms 309900 KB Output is correct
115 Correct 946 ms 315688 KB Output is correct
116 Correct 938 ms 315684 KB Output is correct
117 Correct 924 ms 315180 KB Output is correct
118 Correct 947 ms 315176 KB Output is correct
119 Correct 943 ms 315780 KB Output is correct
120 Correct 884 ms 315344 KB Output is correct
121 Correct 748 ms 316840 KB Output is correct
122 Correct 716 ms 317216 KB Output is correct
123 Correct 730 ms 316960 KB Output is correct
124 Correct 784 ms 316840 KB Output is correct
125 Correct 237 ms 315624 KB Output is correct
126 Correct 235 ms 315308 KB Output is correct
127 Correct 237 ms 315168 KB Output is correct
128 Correct 137 ms 317216 KB Output is correct
129 Correct 144 ms 316916 KB Output is correct
130 Correct 236 ms 315416 KB Output is correct
131 Correct 246 ms 315684 KB Output is correct
132 Correct 265 ms 315844 KB Output is correct
133 Correct 229 ms 315168 KB Output is correct
134 Correct 232 ms 315172 KB Output is correct
135 Correct 244 ms 315172 KB Output is correct
136 Correct 228 ms 315308 KB Output is correct
137 Correct 133 ms 316792 KB Output is correct
138 Correct 132 ms 317216 KB Output is correct
139 Correct 145 ms 316868 KB Output is correct
140 Correct 133 ms 317108 KB Output is correct
141 Correct 58 ms 304208 KB Output is correct
142 Correct 58 ms 304208 KB Output is correct
143 Correct 61 ms 304124 KB Output is correct
144 Correct 56 ms 304232 KB Output is correct
145 Correct 57 ms 304124 KB Output is correct
146 Correct 56 ms 304076 KB Output is correct
147 Correct 64 ms 304208 KB Output is correct
148 Correct 57 ms 304208 KB Output is correct
149 Correct 58 ms 304244 KB Output is correct
150 Correct 57 ms 304208 KB Output is correct
151 Correct 56 ms 304232 KB Output is correct
152 Correct 57 ms 304208 KB Output is correct
153 Correct 56 ms 304148 KB Output is correct
154 Correct 57 ms 304208 KB Output is correct
155 Correct 57 ms 304360 KB Output is correct
156 Correct 65 ms 304220 KB Output is correct
157 Correct 830 ms 315024 KB Output is correct
158 Correct 980 ms 315688 KB Output is correct
159 Correct 963 ms 315960 KB Output is correct
160 Correct 986 ms 315176 KB Output is correct
161 Correct 914 ms 315552 KB Output is correct
162 Correct 976 ms 315324 KB Output is correct
163 Correct 992 ms 315388 KB Output is correct
164 Correct 690 ms 316844 KB Output is correct
165 Correct 731 ms 317332 KB Output is correct
166 Correct 749 ms 316868 KB Output is correct
167 Correct 743 ms 316960 KB Output is correct
168 Correct 54 ms 297808 KB Output is correct
169 Correct 619 ms 310732 KB Output is correct
170 Correct 1294 ms 315696 KB Output is correct
171 Correct 1213 ms 315944 KB Output is correct
172 Correct 1257 ms 315168 KB Output is correct
173 Correct 1268 ms 315120 KB Output is correct
174 Correct 1265 ms 315416 KB Output is correct
175 Correct 1257 ms 315340 KB Output is correct
176 Correct 789 ms 316860 KB Output is correct
177 Correct 769 ms 317220 KB Output is correct
178 Correct 817 ms 316840 KB Output is correct
179 Correct 774 ms 317088 KB Output is correct