Submission #906036

# Submission time Handle Problem Language Result Execution time Memory
906036 2024-01-13T10:57:35 Z nguyentunglam New Home (APIO18_new_home) C++17
100 / 100
4671 ms 378600 KB
#include<bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define endl "\n"
using namespace std;

const int N = 3e5 + 10;

int n, k, q, sz;

int x[N * 3], t[N], a[N], b[N], cost[N], c[N], y[N], ans[N];

int pre[N * 3], nxt[N * 3];

vector<int> rrh, open[N * 3], close[N * 3], event[N * 3];

bool alive[N * 3];

bool bug;

priority_queue<pair<int, int> > bit0[N], bit1[N];

void add0 (int pos, int border, pair<int, int> tmp) {
  while (pos >= border) {
    bit0[pos].push(tmp);
    pos -= pos & -pos;
  }
}

int get0(int pos, int _pos) {
  int ret = 0;
  while (pos <= sz) {
    while (!bit0[pos].empty()) {
      int i = bit0[pos].top().second;
      int j = nxt[i];
      if (alive[i] == 0 || x[i] == x[j] || abs(x[i] - _pos) > abs(x[j] - _pos)) bit0[pos].pop();
      else {
        ret = max(ret, _pos - x[i]);
        break;
      }
    }
    pos += pos & -pos;
  }
  return ret;
}

void add1 (int pos, int border, pair<int, int> tmp) {
  while (pos <= border) {
    bit1[pos].push(tmp);
    pos += pos & -pos;
  }
}

int get1(int pos, int _pos) {
  int ret = 0;
  while (pos) {
    while (!bit1[pos].empty()) {
      int i = bit1[pos].top().second;
      int j = pre[i];
      if (alive[i] == 0 || x[i] == x[j] || abs(x[i] - _pos) > abs(x[j] - _pos)) bit1[pos].pop();
      else {
        ret = max(ret, x[i] - _pos);
        break;
      }
    }
    pos -= pos & -pos;
  }
  return ret;
}

void compress () {
  sort(all(rrh));
  rrh.resize(unique(all(rrh)) - rrh.begin());
}

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

struct BIT {
  vector<pair<int, int> > rrh;
  vector<int> bit;
  int m, lg;
  void compress () {
    sort(all(rrh));
    rrh.resize(unique(all(rrh)) - rrh.begin());
    m = rrh.size();
    lg = log2(m);
    bit.resize(m + 1);
  }

  void up(int pos, int val) {
    while (pos <= m) {
      bit[pos] += val;
      pos += pos & -pos;
    }
  }

  int get (int pos) {
    int ret = 0;
    while (pos) {
      ret += bit[pos];
      pos -= pos & -pos;
    }
    return ret;
  }

  int reach (int sum) {
    int cur = 0, pos = 0;
    for(int j = lg; j >= 0; j--) {
      int x = pos + (1 << j);
      if (x <= m && cur + bit[x] <= sum) cur += bit[pos = x];
    }
    return pos;
  }

  pair<int, int> add (pair<int, int> tmp) {
    int pos = upper_bound(all(rrh), tmp) - rrh.begin();
    up(pos, 1);
    int sum = get(pos);
    int l = reach(sum - 2) + 1;
    int r = reach(sum) + 1;
    l = rrh[l - 1].second;
    r = rrh[r - 1].second;
    return make_pair(l, r);
  }

  pair<int, int> del (pair<int, int> tmp) {
    int pos = upper_bound(all(rrh), tmp) - rrh.begin();
    int sum = get(pos);
    int l = reach(sum - 2) + 1;
    int r = reach(sum) + 1;
    l = rrh[l - 1].second;
    r = rrh[r - 1].second;
    up(pos, -1);
    return make_pair(l, r);
  }
} bit[N];

int32_t main() {
  #define task ""

  cin.tie(0) -> sync_with_stdio(0);

  if (fopen("task.inp", "r")) {
    freopen("task.inp", "r", stdin);
    freopen("task.out", "w", stdout);
  }

  if (fopen(task".inp", "r")) {
    freopen (task".inp", "r", stdin);
    freopen (task".out", "w", stdout);
  }

  cin >> n >> k >> q;

  for(int i = 1; i <= n; i++) cin >> x[i] >> t[i] >> a[i] >> b[i];

  for(int i = 1; i <= q; i++) cin >> c[i] >> y[i];

  for(int i = 1; i <= n; i++) {
    rrh.push_back(a[i]);
    rrh.push_back(b[i]);
  }
  for(int i = 1; i <= q; i++) rrh.push_back(y[i]);

  compress();

  for(int i = 1; i <= n; i++) {
    a[i] = id(a[i]);
    b[i] = id(b[i]);
    open[a[i]].push_back(i);
    close[b[i]].push_back(i);
  }

  for(int i = 1; i <= q; i++) {
    y[i] = id(y[i]);
    event[y[i]].push_back(i);
  }

  int m = rrh.size();

  rrh.clear();
  for(int i = 1; i <= q; i++) rrh.push_back(c[i]);
  compress();

  int cnt = n;
  sz = rrh.size();

  for(int i = 1; i <= n; i++) bit[t[i]].rrh.emplace_back(x[i], i);

  for(int i = 1; i <= k; i++) {
    x[cnt + 1] = -1e9;
    x[cnt + 2] = 1e9;
    alive[cnt + 1] = alive[cnt + 2] = 1;
    add1(1, sz, make_pair(x[cnt + 2], cnt + 2));
    nxt[cnt + 1] = cnt + 2;
    pre[cnt + 2] = cnt + 1;

    bit[i].rrh.emplace_back(x[cnt + 1], cnt + 1);
    bit[i].rrh.emplace_back(x[cnt + 2], cnt + 2);

    bit[i].compress();

    bit[i].add(make_pair(x[cnt + 1], cnt + 1));
    bit[i].add(make_pair(x[cnt + 2], cnt + 2));
    cnt += 2;
  }

  for(int cur = 1; cur <= m; cur++) {
    for(int &j : open[cur]) {
      int from, to;
      tie(from, to) = bit[t[j]].add(make_pair(x[j], j));
//      cout << from << " " << to << "add\n";
      int middle;
      middle = id(x[from] + x[j] >> 1);
      int L = id(x[from] - 1) + 1, R = id(x[to]), pos = id(x[j]);

      add0(middle, L, make_pair(-x[from], from));
      add1(middle + 1, pos, make_pair(x[j], j));

      middle = id(x[j] + x[to] >> 1);
      pos = id(x[j] - 1) + 1;

      add0(middle, pos, make_pair(-x[j], j));
      add1(middle + 1, R, make_pair(x[to], to));

      nxt[from] = j;
      pre[j] = from;
      nxt[j] = to;
      pre[to] = j;
      alive[j] = 1;
    }
    for(int &j : event[cur]) {
      int tmp = id(c[j]);
      int cost1 = get0(tmp, c[j]);
      int cost2 = get1(tmp, c[j]);
      ans[j] = max(cost1, cost2);
    }
    for(int &j : close[cur]) {
      int from, to;
      tie(from, to) = bit[t[j]].del(make_pair(x[j], j));

//      cout << bit[1].get(1) << " " << from << " " << to << "del\n";

      int L = id(x[from] - 1) + 1, R = id(x[to]), middle = id(x[from] + x[to] >> 1);
      add0(middle, L, make_pair(-x[from], from));
      add1(middle + 1, R, make_pair(x[to], to));


      nxt[from] = to;
      pre[to] = from;
      alive[j] = 0;
    }
  }

  cerr << 1.0 * clock() / CLOCKS_PER_SEC << endl;

  for(int i = 1; i <= q; i++) {
    if (ans[i] > 1e8) ans[i] = -1;
    cout << ans[i] << endl;
  }

}

Compilation message

new_home.cpp: In function 'int32_t main()':
new_home.cpp:215:27: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  215 |       middle = id(x[from] + x[j] >> 1);
      |                   ~~~~~~~~^~~~~~
new_home.cpp:221:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  221 |       middle = id(x[j] + x[to] >> 1);
      |                   ~~~~~^~~~~~~
new_home.cpp:245:71: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  245 |       int L = id(x[from] - 1) + 1, R = id(x[to]), middle = id(x[from] + x[to] >> 1);
      |                                                               ~~~~~~~~^~~~~~~
new_home.cpp:145:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  145 |     freopen("task.inp", "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
new_home.cpp:146:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  146 |     freopen("task.out", "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
new_home.cpp:150:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  150 |     freopen (task".inp", "r", stdin);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
new_home.cpp:151:13: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
  151 |     freopen (task".out", "w", stdout);
      |     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 33 ms 111184 KB Output is correct
2 Correct 33 ms 111192 KB Output is correct
3 Correct 34 ms 111188 KB Output is correct
4 Correct 33 ms 111188 KB Output is correct
5 Correct 34 ms 111440 KB Output is correct
6 Correct 34 ms 111404 KB Output is correct
7 Correct 34 ms 111452 KB Output is correct
8 Correct 34 ms 111608 KB Output is correct
9 Correct 35 ms 111452 KB Output is correct
10 Correct 37 ms 111388 KB Output is correct
11 Correct 34 ms 111452 KB Output is correct
12 Correct 36 ms 111596 KB Output is correct
13 Correct 34 ms 111596 KB Output is correct
14 Correct 34 ms 111444 KB Output is correct
15 Correct 34 ms 111560 KB Output is correct
16 Correct 34 ms 111604 KB Output is correct
17 Correct 34 ms 111444 KB Output is correct
18 Correct 34 ms 111452 KB Output is correct
19 Correct 35 ms 111616 KB Output is correct
20 Correct 34 ms 111408 KB Output is correct
21 Correct 34 ms 111444 KB Output is correct
22 Correct 34 ms 111452 KB Output is correct
23 Correct 34 ms 111592 KB Output is correct
24 Correct 36 ms 111576 KB Output is correct
25 Correct 36 ms 111444 KB Output is correct
26 Correct 36 ms 111444 KB Output is correct
27 Correct 34 ms 111440 KB Output is correct
28 Correct 34 ms 111452 KB Output is correct
29 Correct 34 ms 111408 KB Output is correct
30 Correct 34 ms 111452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 111184 KB Output is correct
2 Correct 33 ms 111192 KB Output is correct
3 Correct 34 ms 111188 KB Output is correct
4 Correct 33 ms 111188 KB Output is correct
5 Correct 34 ms 111440 KB Output is correct
6 Correct 34 ms 111404 KB Output is correct
7 Correct 34 ms 111452 KB Output is correct
8 Correct 34 ms 111608 KB Output is correct
9 Correct 35 ms 111452 KB Output is correct
10 Correct 37 ms 111388 KB Output is correct
11 Correct 34 ms 111452 KB Output is correct
12 Correct 36 ms 111596 KB Output is correct
13 Correct 34 ms 111596 KB Output is correct
14 Correct 34 ms 111444 KB Output is correct
15 Correct 34 ms 111560 KB Output is correct
16 Correct 34 ms 111604 KB Output is correct
17 Correct 34 ms 111444 KB Output is correct
18 Correct 34 ms 111452 KB Output is correct
19 Correct 35 ms 111616 KB Output is correct
20 Correct 34 ms 111408 KB Output is correct
21 Correct 34 ms 111444 KB Output is correct
22 Correct 34 ms 111452 KB Output is correct
23 Correct 34 ms 111592 KB Output is correct
24 Correct 36 ms 111576 KB Output is correct
25 Correct 36 ms 111444 KB Output is correct
26 Correct 36 ms 111444 KB Output is correct
27 Correct 34 ms 111440 KB Output is correct
28 Correct 34 ms 111452 KB Output is correct
29 Correct 34 ms 111408 KB Output is correct
30 Correct 34 ms 111452 KB Output is correct
31 Correct 591 ms 140416 KB Output is correct
32 Correct 106 ms 117708 KB Output is correct
33 Correct 434 ms 131760 KB Output is correct
34 Correct 630 ms 142072 KB Output is correct
35 Correct 505 ms 137164 KB Output is correct
36 Correct 450 ms 130716 KB Output is correct
37 Correct 310 ms 133268 KB Output is correct
38 Correct 303 ms 128668 KB Output is correct
39 Correct 270 ms 130072 KB Output is correct
40 Correct 255 ms 128668 KB Output is correct
41 Correct 456 ms 138544 KB Output is correct
42 Correct 401 ms 138700 KB Output is correct
43 Correct 79 ms 117416 KB Output is correct
44 Correct 410 ms 137764 KB Output is correct
45 Correct 423 ms 135884 KB Output is correct
46 Correct 376 ms 129484 KB Output is correct
47 Correct 258 ms 134824 KB Output is correct
48 Correct 236 ms 133580 KB Output is correct
49 Correct 281 ms 135640 KB Output is correct
50 Correct 303 ms 138112 KB Output is correct
51 Correct 275 ms 133848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2999 ms 291524 KB Output is correct
2 Correct 2560 ms 185544 KB Output is correct
3 Correct 2606 ms 318140 KB Output is correct
4 Correct 2833 ms 293588 KB Output is correct
5 Correct 1962 ms 160912 KB Output is correct
6 Correct 2667 ms 177888 KB Output is correct
7 Correct 2232 ms 295176 KB Output is correct
8 Correct 2528 ms 295652 KB Output is correct
9 Correct 2845 ms 283552 KB Output is correct
10 Correct 3012 ms 232616 KB Output is correct
11 Correct 1177 ms 194012 KB Output is correct
12 Correct 1251 ms 226068 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4671 ms 275688 KB Output is correct
2 Correct 454 ms 145052 KB Output is correct
3 Correct 3567 ms 205820 KB Output is correct
4 Correct 2640 ms 348652 KB Output is correct
5 Correct 3800 ms 304320 KB Output is correct
6 Correct 3512 ms 310780 KB Output is correct
7 Correct 2347 ms 179884 KB Output is correct
8 Correct 2996 ms 197520 KB Output is correct
9 Correct 2516 ms 331672 KB Output is correct
10 Correct 3257 ms 306920 KB Output is correct
11 Correct 3955 ms 297684 KB Output is correct
12 Correct 3730 ms 242836 KB Output is correct
13 Correct 1122 ms 207808 KB Output is correct
14 Correct 1034 ms 196760 KB Output is correct
15 Correct 1274 ms 212500 KB Output is correct
16 Correct 1479 ms 245768 KB Output is correct
17 Correct 1322 ms 203108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 111184 KB Output is correct
2 Correct 33 ms 111192 KB Output is correct
3 Correct 34 ms 111188 KB Output is correct
4 Correct 33 ms 111188 KB Output is correct
5 Correct 34 ms 111440 KB Output is correct
6 Correct 34 ms 111404 KB Output is correct
7 Correct 34 ms 111452 KB Output is correct
8 Correct 34 ms 111608 KB Output is correct
9 Correct 35 ms 111452 KB Output is correct
10 Correct 37 ms 111388 KB Output is correct
11 Correct 34 ms 111452 KB Output is correct
12 Correct 36 ms 111596 KB Output is correct
13 Correct 34 ms 111596 KB Output is correct
14 Correct 34 ms 111444 KB Output is correct
15 Correct 34 ms 111560 KB Output is correct
16 Correct 34 ms 111604 KB Output is correct
17 Correct 34 ms 111444 KB Output is correct
18 Correct 34 ms 111452 KB Output is correct
19 Correct 35 ms 111616 KB Output is correct
20 Correct 34 ms 111408 KB Output is correct
21 Correct 34 ms 111444 KB Output is correct
22 Correct 34 ms 111452 KB Output is correct
23 Correct 34 ms 111592 KB Output is correct
24 Correct 36 ms 111576 KB Output is correct
25 Correct 36 ms 111444 KB Output is correct
26 Correct 36 ms 111444 KB Output is correct
27 Correct 34 ms 111440 KB Output is correct
28 Correct 34 ms 111452 KB Output is correct
29 Correct 34 ms 111408 KB Output is correct
30 Correct 34 ms 111452 KB Output is correct
31 Correct 591 ms 140416 KB Output is correct
32 Correct 106 ms 117708 KB Output is correct
33 Correct 434 ms 131760 KB Output is correct
34 Correct 630 ms 142072 KB Output is correct
35 Correct 505 ms 137164 KB Output is correct
36 Correct 450 ms 130716 KB Output is correct
37 Correct 310 ms 133268 KB Output is correct
38 Correct 303 ms 128668 KB Output is correct
39 Correct 270 ms 130072 KB Output is correct
40 Correct 255 ms 128668 KB Output is correct
41 Correct 456 ms 138544 KB Output is correct
42 Correct 401 ms 138700 KB Output is correct
43 Correct 79 ms 117416 KB Output is correct
44 Correct 410 ms 137764 KB Output is correct
45 Correct 423 ms 135884 KB Output is correct
46 Correct 376 ms 129484 KB Output is correct
47 Correct 258 ms 134824 KB Output is correct
48 Correct 236 ms 133580 KB Output is correct
49 Correct 281 ms 135640 KB Output is correct
50 Correct 303 ms 138112 KB Output is correct
51 Correct 275 ms 133848 KB Output is correct
52 Correct 427 ms 155564 KB Output is correct
53 Correct 424 ms 156324 KB Output is correct
54 Correct 480 ms 150416 KB Output is correct
55 Correct 403 ms 146448 KB Output is correct
56 Correct 398 ms 145540 KB Output is correct
57 Correct 377 ms 138100 KB Output is correct
58 Correct 442 ms 145608 KB Output is correct
59 Correct 423 ms 146760 KB Output is correct
60 Correct 431 ms 139612 KB Output is correct
61 Correct 87 ms 123588 KB Output is correct
62 Correct 454 ms 147076 KB Output is correct
63 Correct 436 ms 149960 KB Output is correct
64 Correct 444 ms 148852 KB Output is correct
65 Correct 476 ms 142068 KB Output is correct
66 Correct 422 ms 140176 KB Output is correct
67 Correct 127 ms 124108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 111184 KB Output is correct
2 Correct 33 ms 111192 KB Output is correct
3 Correct 34 ms 111188 KB Output is correct
4 Correct 33 ms 111188 KB Output is correct
5 Correct 34 ms 111440 KB Output is correct
6 Correct 34 ms 111404 KB Output is correct
7 Correct 34 ms 111452 KB Output is correct
8 Correct 34 ms 111608 KB Output is correct
9 Correct 35 ms 111452 KB Output is correct
10 Correct 37 ms 111388 KB Output is correct
11 Correct 34 ms 111452 KB Output is correct
12 Correct 36 ms 111596 KB Output is correct
13 Correct 34 ms 111596 KB Output is correct
14 Correct 34 ms 111444 KB Output is correct
15 Correct 34 ms 111560 KB Output is correct
16 Correct 34 ms 111604 KB Output is correct
17 Correct 34 ms 111444 KB Output is correct
18 Correct 34 ms 111452 KB Output is correct
19 Correct 35 ms 111616 KB Output is correct
20 Correct 34 ms 111408 KB Output is correct
21 Correct 34 ms 111444 KB Output is correct
22 Correct 34 ms 111452 KB Output is correct
23 Correct 34 ms 111592 KB Output is correct
24 Correct 36 ms 111576 KB Output is correct
25 Correct 36 ms 111444 KB Output is correct
26 Correct 36 ms 111444 KB Output is correct
27 Correct 34 ms 111440 KB Output is correct
28 Correct 34 ms 111452 KB Output is correct
29 Correct 34 ms 111408 KB Output is correct
30 Correct 34 ms 111452 KB Output is correct
31 Correct 591 ms 140416 KB Output is correct
32 Correct 106 ms 117708 KB Output is correct
33 Correct 434 ms 131760 KB Output is correct
34 Correct 630 ms 142072 KB Output is correct
35 Correct 505 ms 137164 KB Output is correct
36 Correct 450 ms 130716 KB Output is correct
37 Correct 310 ms 133268 KB Output is correct
38 Correct 303 ms 128668 KB Output is correct
39 Correct 270 ms 130072 KB Output is correct
40 Correct 255 ms 128668 KB Output is correct
41 Correct 456 ms 138544 KB Output is correct
42 Correct 401 ms 138700 KB Output is correct
43 Correct 79 ms 117416 KB Output is correct
44 Correct 410 ms 137764 KB Output is correct
45 Correct 423 ms 135884 KB Output is correct
46 Correct 376 ms 129484 KB Output is correct
47 Correct 258 ms 134824 KB Output is correct
48 Correct 236 ms 133580 KB Output is correct
49 Correct 281 ms 135640 KB Output is correct
50 Correct 303 ms 138112 KB Output is correct
51 Correct 275 ms 133848 KB Output is correct
52 Correct 2999 ms 291524 KB Output is correct
53 Correct 2560 ms 185544 KB Output is correct
54 Correct 2606 ms 318140 KB Output is correct
55 Correct 2833 ms 293588 KB Output is correct
56 Correct 1962 ms 160912 KB Output is correct
57 Correct 2667 ms 177888 KB Output is correct
58 Correct 2232 ms 295176 KB Output is correct
59 Correct 2528 ms 295652 KB Output is correct
60 Correct 2845 ms 283552 KB Output is correct
61 Correct 3012 ms 232616 KB Output is correct
62 Correct 1177 ms 194012 KB Output is correct
63 Correct 1251 ms 226068 KB Output is correct
64 Correct 4671 ms 275688 KB Output is correct
65 Correct 454 ms 145052 KB Output is correct
66 Correct 3567 ms 205820 KB Output is correct
67 Correct 2640 ms 348652 KB Output is correct
68 Correct 3800 ms 304320 KB Output is correct
69 Correct 3512 ms 310780 KB Output is correct
70 Correct 2347 ms 179884 KB Output is correct
71 Correct 2996 ms 197520 KB Output is correct
72 Correct 2516 ms 331672 KB Output is correct
73 Correct 3257 ms 306920 KB Output is correct
74 Correct 3955 ms 297684 KB Output is correct
75 Correct 3730 ms 242836 KB Output is correct
76 Correct 1122 ms 207808 KB Output is correct
77 Correct 1034 ms 196760 KB Output is correct
78 Correct 1274 ms 212500 KB Output is correct
79 Correct 1479 ms 245768 KB Output is correct
80 Correct 1322 ms 203108 KB Output is correct
81 Correct 427 ms 155564 KB Output is correct
82 Correct 424 ms 156324 KB Output is correct
83 Correct 480 ms 150416 KB Output is correct
84 Correct 403 ms 146448 KB Output is correct
85 Correct 398 ms 145540 KB Output is correct
86 Correct 377 ms 138100 KB Output is correct
87 Correct 442 ms 145608 KB Output is correct
88 Correct 423 ms 146760 KB Output is correct
89 Correct 431 ms 139612 KB Output is correct
90 Correct 87 ms 123588 KB Output is correct
91 Correct 454 ms 147076 KB Output is correct
92 Correct 436 ms 149960 KB Output is correct
93 Correct 444 ms 148852 KB Output is correct
94 Correct 476 ms 142068 KB Output is correct
95 Correct 422 ms 140176 KB Output is correct
96 Correct 127 ms 124108 KB Output is correct
97 Correct 3155 ms 378600 KB Output is correct
98 Correct 434 ms 141716 KB Output is correct
99 Correct 3658 ms 221316 KB Output is correct
100 Correct 2825 ms 360112 KB Output is correct
101 Correct 3621 ms 317136 KB Output is correct
102 Correct 3647 ms 216404 KB Output is correct
103 Correct 2111 ms 228288 KB Output is correct
104 Correct 1945 ms 205652 KB Output is correct
105 Correct 1396 ms 211180 KB Output is correct
106 Correct 1335 ms 205312 KB Output is correct
107 Correct 2787 ms 283836 KB Output is correct
108 Correct 2813 ms 296972 KB Output is correct
109 Correct 2977 ms 291612 KB Output is correct
110 Correct 3168 ms 308848 KB Output is correct
111 Correct 2974 ms 287012 KB Output is correct
112 Correct 3048 ms 298772 KB Output is correct
113 Correct 332 ms 172992 KB Output is correct
114 Correct 3054 ms 339608 KB Output is correct
115 Correct 3364 ms 328756 KB Output is correct
116 Correct 3252 ms 302608 KB Output is correct
117 Correct 3623 ms 322920 KB Output is correct
118 Correct 3587 ms 267560 KB Output is correct
119 Correct 706 ms 177344 KB Output is correct
120 Correct 1198 ms 257620 KB Output is correct
121 Correct 1242 ms 230592 KB Output is correct
122 Correct 1254 ms 231668 KB Output is correct
123 Correct 1414 ms 230000 KB Output is correct
124 Correct 1690 ms 251604 KB Output is correct
125 Correct 1539 ms 228288 KB Output is correct
126 Correct 1613 ms 274880 KB Output is correct