Submission #825499

# Submission time Handle Problem Language Result Execution time Memory
825499 2023-08-14T23:30:47 Z null_awe Maze (JOI23_ho_t3) C++14
51 / 100
2000 ms 135344 KB
#include <bits/stdc++.h>
using namespace std;

#define pii pair<int, int>

vector<int> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};

struct Segtree {

  int n;
  vector<bool> on;

  Segtree() {}

  Segtree(int n) : n(n), on(4 * n, 1) {}

  void upd(int t, int tl, int tr, int p) {
    if (tl == tr) on[t] = false;
    else {
      int m = (tl + tr) / 2;
      if (p <= m) upd(2 * t, tl, m, p);
      else upd(2 * t + 1, m + 1, tr, p);
      on[t] = on[2 * t] | on[2 * t + 1];
    }
  }

  int qry(int t, int tl, int tr, int l, int r) {
    l = max(l, tl), r = min(r, tr);
    if (l > r) return -1;
    if (tl == l && tr == r && !on[t]) return -1;
    if (tl == tr) {
      assert(on[t]);
      return tl;
    }
    int m = (tl + tr) / 2;
    int f = qry(2 * t, tl, m, l, r);
    if (f >= 0) return f;
    return qry(2 * t + 1, m + 1, tr, l, r);
  }
};

struct Groups {

  int r, c;
  vector<Segtree> rs, cs;

  Groups() {}

  Groups(int r, int c) : r(r), c(c) {
    for (int i = 0; i < r; ++i) {
      Segtree tmp(c);
      rs.push_back(tmp);
    }
    for (int i = 0; i < c; ++i) {
      Segtree tmp(r);
      cs.push_back(tmp);
    }
  }

  void upd(int x, int y) {
    // cout << x << ' ' << y << endl;
    rs[x].upd(1, 0, c - 1, y);
    cs[y].upd(1, 0, r - 1, x);
    // cout << "done" << endl;
  }

  int qrow(int row, int l, int rr) {
    if (row < 0 || row >= r) return -1;
    return rs[row].qry(1, 0, c - 1, max(l, 0), min(rr, c - 1));
  }

  int qcol(int col, int l, int rr) {
    if (col < 0 || col >= c) return -1;
    return cs[col].qry(1, 0, r - 1, max(l, 0), min(rr, r - 1));
  }
};

int main() {
  int r, c, n; cin >> r >> c >> n;
  int sx, sy; cin >> sx >> sy; --sx, --sy;
  int gx, gy; cin >> gx >> gy; --gx, --gy;
  vector<string> arr(r);
  for (int i = 0; i < r; ++i) cin >> arr[i];
  // . = empty
  // # = wall
  Groups groups(r, c);
  vector<vector<int>> dists(r, vector<int>(c, INT_MAX));
  dists[sx][sy] = 0;
  // cout << dists[gx][gy] << '\n';
  groups.upd(sx, sy);
  // cout << groups.qrow(sx, sy, sy) << endl;
  vector<pii> q; q.push_back({sx, sy});
  queue<pii> rq; for (pii _p : q) rq.push(_p);
  while (rq.size()) {
    pii front = rq.front(); rq.pop();
    int xx = front.first, yy = front.second;
    for (int d = 0; d < 4; ++d) {
      int nx = xx + dx[d], ny = yy + dy[d];
      if (nx < 0 || ny < 0 || nx >= r || ny >= c) continue;
      if (dists[nx][ny] < INT_MAX || arr[nx][ny] == '#') continue;
      rq.push({nx, ny});
      q.push_back({nx, ny});
      dists[nx][ny] = dists[xx][yy];
      groups.upd(nx, ny);
    }
  }
  while (q.size()) {
    // for (int i = 0; i < r; ++i) {
      // for (int j = 0; j < c; ++j) cout << dists[i][j] << ' ';
      // cout << endl;
    // }
    // break;
    // cout << "here" << endl;
    // break;
    vector<pii> nq;
    for (pii p : q) {
      int x = p.first, y = p.second;
      // cout << x << ' ' << y << '\n';
      // if (x > 0 && dists[x - 1][y] <= dists[x][y]) {
      //     // cout << "t1" << endl;
      //   // query up:
      //   int cur;
      //   while ((cur = groups.qrow(x + n, y - n + 1, y + n - 1)) != -1) {
      //     nq.push_back({x + n, cur});
      //     dists[x + n][cur] = dists[x][y] + 1;
      //     groups.upd(x + n, cur);
      //   }
      //   if (x + n - 1 < r && y - n >= 0 && dists[x + n - 1][y - n] == INT_MAX) {
      //     nq.push_back({x + n - 1, y - n});
      //     dists[x + n - 1][y - n] = dists[x][y] + 1;
      //     groups.upd(x + n - 1, y - n);
      //   }
      //   if (x + n - 1 < r && y + n < c && dists[x + n - 1][y - n] == INT_MAX) {
      //     nq.push_back({x + n - 1, y + n});
      //     dists[x + n - 1][y + n] = dists[x][y] + 1;
      //     groups.upd(x + n - 1, y + n);
      //   }
      // } else if (x < r - 1 && dists[x + 1][y] <= dists[x][y]) {
      //     // cout << "t2" << endl;
      //   // query down:
      //   int cur;
      //   while ((cur = groups.qrow(x - n, y - n + 1, y + n - 1)) != -1) {
      //     nq.push_back({x - n, cur});
      //     dists[x - n][cur] = dists[x][y] + 1;
      //     groups.upd(x - n, cur);
      //   }
      //   if (x - n + 1 >= 0 && y - n >= 0 && dists[x - n + 1][y - n] == INT_MAX) {
      //     nq.push_back({x - n + 1, y - n});
      //     dists[x - n + 1][y - n] = dists[x][y] + 1;
      //     groups.upd(x - n + 1, y - n);
      //   }
      //   if (x - n + 1 >= 0 && y + n < c && dists[x - n + 1][y - n] == INT_MAX) {
      //     nq.push_back({x - n + 1, y + n});
      //     dists[x - n + 1][y + n] = dists[x][y] + 1;
      //     groups.upd(x - n + 1, y + n);
      //   }
      // } else if (y > 0 && dists[x][y - 1] <= dists[x][y]) {
      //     // cout << "t3" << endl;
      //   // query left:
      //   int cur;
      //   while ((cur = groups.qcol(y + n, x - n + 1, x + n - 1)) != -1) {
      //     nq.push_back({cur, y + n});
      //     dists[cur][y + n] = dists[x][y] + 1;
      //     groups.upd(cur, y + n);
      //   }
      //   if (y + n - 1 < c && x - n >= 0 && dists[x - n][y + n - 1] == INT_MAX) {
      //     nq.push_back({x - n, y + n - 1});
      //     dists[x - n][y + n - 1] = dists[x][y] + 1;
      //     groups.upd(x - n, y + n - 1);
      //   }
      //   if (y + n - 1 < c && x + n < r && dists[x + n][y + n - 1] == INT_MAX) {
      //     nq.push_back({x + n, y + n - 1});
      //     dists[x + n][y + n - 1] = dists[x][y] + 1;
      //     groups.upd(x + n, y + n - 1);
      //   }
      // } else if (y < r - 1 && dists[x][y + 1] <= dists[x][y]) {
      //     // cout << "t4" << endl;
      //   // query right:
      //   int cur;
      //   while ((cur = groups.qcol(y - n, x - n + 1, x + n - 1)) != -1) {
      //     nq.push_back({cur, y - n});
      //     dists[cur][y - n] = dists[x][y] + 1;
      //     groups.upd(cur, y - n);
      //   }
      //   if (y - n + 1 >= 0 && x - n >= 0 && dists[x - n][y - n + 1] == INT_MAX) {
      //     nq.push_back({x - n, y - n + 1});
      //     dists[x - n][y - n + 1] = dists[x][y] + 1;
      //     groups.upd(x - n, y - n + 1);
      //   }
      //   if (y - n + 1 >= 0 && x + n < r && dists[x + n][y - n + 1] == INT_MAX) {
      //     nq.push_back({x + n, y - n + 1});
      //     dists[x + n][y - n + 1] = dists[x][y] + 1;
      //     groups.upd(x + n, y - n + 1);
      //   }
      // } else {
        // query all:
        for (int i = -n; i <= n; ++i) {
          int cx = x + i, cyl = y - n, cyr = y + n;
          if (abs(i) == n) ++cyl, --cyr;
          int cur;
          while ((cur = groups.qrow(cx, cyl, cyr)) != -1) {
            nq.push_back({cx, cur});
            dists[cx][cur] = dists[x][y] + 1;
            groups.upd(cx, cur);
          }
        }
      // }
    }
    queue<pii> rq; for (pii _p : nq) rq.push(_p);
    while (rq.size()) {
      pii front = rq.front(); rq.pop();
      int xx = front.first, yy = front.second;
      for (int d = 0; d < 4; ++d) {
        int nx = xx + dx[d], ny = yy + dy[d];
        if (nx < 0 || ny < 0 || nx >= r || ny >= c) continue;
        if (dists[nx][ny] < INT_MAX || arr[nx][ny] == '#') continue;
        rq.push({nx, ny});
        nq.push_back({nx, ny});
        dists[nx][ny] = dists[xx][yy];
        groups.upd(nx, ny);
      }
    }
    q = nq;
  }
  cout << dists[gx][gy] << '\n';
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 23 ms 840 KB Output is correct
20 Correct 27 ms 4480 KB Output is correct
21 Correct 18 ms 1380 KB Output is correct
22 Correct 23 ms 904 KB Output is correct
23 Correct 20 ms 820 KB Output is correct
24 Correct 20 ms 5576 KB Output is correct
25 Correct 31 ms 5628 KB Output is correct
26 Correct 22 ms 1168 KB Output is correct
27 Correct 23 ms 908 KB Output is correct
28 Correct 21 ms 852 KB Output is correct
29 Correct 58 ms 1480 KB Output is correct
30 Correct 31 ms 3192 KB Output is correct
31 Correct 48 ms 3532 KB Output is correct
32 Correct 60 ms 1584 KB Output is correct
33 Correct 59 ms 1484 KB Output is correct
34 Correct 57 ms 16996 KB Output is correct
35 Correct 81 ms 17056 KB Output is correct
36 Correct 59 ms 1928 KB Output is correct
37 Correct 60 ms 1692 KB Output is correct
38 Correct 56 ms 1492 KB Output is correct
39 Correct 820 ms 11756 KB Output is correct
40 Correct 72 ms 2336 KB Output is correct
41 Correct 76 ms 17172 KB Output is correct
42 Correct 94 ms 2044 KB Output is correct
43 Correct 131 ms 11788 KB Output is correct
44 Correct 335 ms 15212 KB Output is correct
45 Correct 430 ms 18672 KB Output is correct
46 Correct 632 ms 28160 KB Output is correct
47 Correct 747 ms 11980 KB Output is correct
48 Correct 730 ms 11684 KB Output is correct
49 Correct 560 ms 135248 KB Output is correct
50 Correct 861 ms 135344 KB Output is correct
51 Correct 737 ms 13668 KB Output is correct
52 Correct 749 ms 12480 KB Output is correct
53 Correct 716 ms 11844 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 300 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 296 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 296 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 244 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 300 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 300 KB Output is correct
17 Correct 1 ms 300 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 328 KB Output is correct
23 Correct 2 ms 216 KB Output is correct
24 Correct 3 ms 340 KB Output is correct
25 Correct 22 ms 692 KB Output is correct
26 Correct 49 ms 1332 KB Output is correct
27 Correct 18 ms 1368 KB Output is correct
28 Correct 105 ms 1468 KB Output is correct
29 Correct 97 ms 2260 KB Output is correct
30 Correct 94 ms 2252 KB Output is correct
31 Correct 289 ms 1096 KB Output is correct
32 Correct 22 ms 1140 KB Output is correct
33 Correct 22 ms 852 KB Output is correct
34 Correct 793 ms 2408 KB Output is correct
35 Correct 46 ms 3536 KB Output is correct
36 Correct 357 ms 3524 KB Output is correct
37 Correct 376 ms 4976 KB Output is correct
38 Correct 359 ms 5008 KB Output is correct
39 Correct 1601 ms 7944 KB Output is correct
40 Execution timed out 2083 ms 18956 KB Time limit exceeded
41 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 300 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 296 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 296 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 23 ms 724 KB Output is correct
34 Correct 4 ms 340 KB Output is correct
35 Correct 2 ms 596 KB Output is correct
36 Correct 22 ms 596 KB Output is correct
37 Correct 24 ms 4480 KB Output is correct
38 Correct 46 ms 1392 KB Output is correct
39 Correct 18 ms 1368 KB Output is correct
40 Correct 23 ms 852 KB Output is correct
41 Correct 20 ms 824 KB Output is correct
42 Correct 101 ms 1420 KB Output is correct
43 Correct 95 ms 2260 KB Output is correct
44 Correct 96 ms 2232 KB Output is correct
45 Correct 21 ms 5568 KB Output is correct
46 Correct 30 ms 5544 KB Output is correct
47 Correct 30 ms 3048 KB Output is correct
48 Correct 79 ms 1084 KB Output is correct
49 Correct 126 ms 980 KB Output is correct
50 Correct 184 ms 884 KB Output is correct
51 Correct 276 ms 1116 KB Output is correct
52 Correct 22 ms 1176 KB Output is correct
53 Correct 23 ms 852 KB Output is correct
54 Correct 21 ms 852 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 296 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 300 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 296 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 296 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 23 ms 724 KB Output is correct
34 Correct 4 ms 340 KB Output is correct
35 Correct 2 ms 596 KB Output is correct
36 Correct 22 ms 596 KB Output is correct
37 Correct 24 ms 4480 KB Output is correct
38 Correct 46 ms 1392 KB Output is correct
39 Correct 18 ms 1368 KB Output is correct
40 Correct 23 ms 852 KB Output is correct
41 Correct 20 ms 824 KB Output is correct
42 Correct 101 ms 1420 KB Output is correct
43 Correct 95 ms 2260 KB Output is correct
44 Correct 96 ms 2232 KB Output is correct
45 Correct 21 ms 5568 KB Output is correct
46 Correct 30 ms 5544 KB Output is correct
47 Correct 30 ms 3048 KB Output is correct
48 Correct 79 ms 1084 KB Output is correct
49 Correct 126 ms 980 KB Output is correct
50 Correct 184 ms 884 KB Output is correct
51 Correct 276 ms 1116 KB Output is correct
52 Correct 22 ms 1176 KB Output is correct
53 Correct 23 ms 852 KB Output is correct
54 Correct 21 ms 852 KB Output is correct
55 Correct 58 ms 1484 KB Output is correct
56 Correct 31 ms 3192 KB Output is correct
57 Correct 792 ms 2568 KB Output is correct
58 Correct 91 ms 2028 KB Output is correct
59 Correct 48 ms 3544 KB Output is correct
60 Correct 60 ms 1572 KB Output is correct
61 Correct 59 ms 1492 KB Output is correct
62 Correct 369 ms 3536 KB Output is correct
63 Correct 369 ms 4908 KB Output is correct
64 Correct 395 ms 5060 KB Output is correct
65 Correct 55 ms 17028 KB Output is correct
66 Correct 83 ms 17020 KB Output is correct
67 Correct 77 ms 8836 KB Output is correct
68 Correct 283 ms 1884 KB Output is correct
69 Correct 442 ms 1804 KB Output is correct
70 Correct 662 ms 1832 KB Output is correct
71 Correct 999 ms 1992 KB Output is correct
72 Correct 61 ms 1864 KB Output is correct
73 Correct 60 ms 1696 KB Output is correct
74 Correct 56 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 23 ms 840 KB Output is correct
20 Correct 27 ms 4480 KB Output is correct
21 Correct 18 ms 1380 KB Output is correct
22 Correct 23 ms 904 KB Output is correct
23 Correct 20 ms 820 KB Output is correct
24 Correct 20 ms 5576 KB Output is correct
25 Correct 31 ms 5628 KB Output is correct
26 Correct 22 ms 1168 KB Output is correct
27 Correct 23 ms 908 KB Output is correct
28 Correct 21 ms 852 KB Output is correct
29 Correct 58 ms 1480 KB Output is correct
30 Correct 31 ms 3192 KB Output is correct
31 Correct 48 ms 3532 KB Output is correct
32 Correct 60 ms 1584 KB Output is correct
33 Correct 59 ms 1484 KB Output is correct
34 Correct 57 ms 16996 KB Output is correct
35 Correct 81 ms 17056 KB Output is correct
36 Correct 59 ms 1928 KB Output is correct
37 Correct 60 ms 1692 KB Output is correct
38 Correct 56 ms 1492 KB Output is correct
39 Correct 820 ms 11756 KB Output is correct
40 Correct 72 ms 2336 KB Output is correct
41 Correct 76 ms 17172 KB Output is correct
42 Correct 94 ms 2044 KB Output is correct
43 Correct 131 ms 11788 KB Output is correct
44 Correct 335 ms 15212 KB Output is correct
45 Correct 430 ms 18672 KB Output is correct
46 Correct 632 ms 28160 KB Output is correct
47 Correct 747 ms 11980 KB Output is correct
48 Correct 730 ms 11684 KB Output is correct
49 Correct 560 ms 135248 KB Output is correct
50 Correct 861 ms 135344 KB Output is correct
51 Correct 737 ms 13668 KB Output is correct
52 Correct 749 ms 12480 KB Output is correct
53 Correct 716 ms 11844 KB Output is correct
54 Correct 0 ms 212 KB Output is correct
55 Correct 0 ms 212 KB Output is correct
56 Correct 0 ms 212 KB Output is correct
57 Correct 0 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 296 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 340 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 1 ms 300 KB Output is correct
72 Correct 1 ms 212 KB Output is correct
73 Correct 1 ms 212 KB Output is correct
74 Correct 1 ms 212 KB Output is correct
75 Correct 1 ms 300 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 1 ms 212 KB Output is correct
79 Correct 1 ms 296 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 296 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 1 ms 212 KB Output is correct
84 Correct 1 ms 212 KB Output is correct
85 Correct 1 ms 212 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 244 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 0 ms 212 KB Output is correct
91 Correct 0 ms 212 KB Output is correct
92 Correct 1 ms 212 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 1 ms 212 KB Output is correct
95 Correct 1 ms 340 KB Output is correct
96 Correct 1 ms 340 KB Output is correct
97 Correct 1 ms 340 KB Output is correct
98 Correct 0 ms 300 KB Output is correct
99 Correct 1 ms 300 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 300 KB Output is correct
102 Correct 1 ms 300 KB Output is correct
103 Correct 1 ms 212 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 1 ms 212 KB Output is correct
106 Correct 1 ms 212 KB Output is correct
107 Correct 1 ms 328 KB Output is correct
108 Correct 2 ms 216 KB Output is correct
109 Correct 3 ms 340 KB Output is correct
110 Correct 22 ms 692 KB Output is correct
111 Correct 49 ms 1332 KB Output is correct
112 Correct 18 ms 1368 KB Output is correct
113 Correct 105 ms 1468 KB Output is correct
114 Correct 97 ms 2260 KB Output is correct
115 Correct 94 ms 2252 KB Output is correct
116 Correct 289 ms 1096 KB Output is correct
117 Correct 22 ms 1140 KB Output is correct
118 Correct 22 ms 852 KB Output is correct
119 Correct 793 ms 2408 KB Output is correct
120 Correct 46 ms 3536 KB Output is correct
121 Correct 357 ms 3524 KB Output is correct
122 Correct 376 ms 4976 KB Output is correct
123 Correct 359 ms 5008 KB Output is correct
124 Correct 1601 ms 7944 KB Output is correct
125 Execution timed out 2083 ms 18956 KB Time limit exceeded
126 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 23 ms 840 KB Output is correct
20 Correct 27 ms 4480 KB Output is correct
21 Correct 18 ms 1380 KB Output is correct
22 Correct 23 ms 904 KB Output is correct
23 Correct 20 ms 820 KB Output is correct
24 Correct 20 ms 5576 KB Output is correct
25 Correct 31 ms 5628 KB Output is correct
26 Correct 22 ms 1168 KB Output is correct
27 Correct 23 ms 908 KB Output is correct
28 Correct 21 ms 852 KB Output is correct
29 Correct 58 ms 1480 KB Output is correct
30 Correct 31 ms 3192 KB Output is correct
31 Correct 48 ms 3532 KB Output is correct
32 Correct 60 ms 1584 KB Output is correct
33 Correct 59 ms 1484 KB Output is correct
34 Correct 57 ms 16996 KB Output is correct
35 Correct 81 ms 17056 KB Output is correct
36 Correct 59 ms 1928 KB Output is correct
37 Correct 60 ms 1692 KB Output is correct
38 Correct 56 ms 1492 KB Output is correct
39 Correct 820 ms 11756 KB Output is correct
40 Correct 72 ms 2336 KB Output is correct
41 Correct 76 ms 17172 KB Output is correct
42 Correct 94 ms 2044 KB Output is correct
43 Correct 131 ms 11788 KB Output is correct
44 Correct 335 ms 15212 KB Output is correct
45 Correct 430 ms 18672 KB Output is correct
46 Correct 632 ms 28160 KB Output is correct
47 Correct 747 ms 11980 KB Output is correct
48 Correct 730 ms 11684 KB Output is correct
49 Correct 560 ms 135248 KB Output is correct
50 Correct 861 ms 135344 KB Output is correct
51 Correct 737 ms 13668 KB Output is correct
52 Correct 749 ms 12480 KB Output is correct
53 Correct 716 ms 11844 KB Output is correct
54 Correct 0 ms 212 KB Output is correct
55 Correct 0 ms 212 KB Output is correct
56 Correct 0 ms 212 KB Output is correct
57 Correct 0 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 296 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 340 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 1 ms 300 KB Output is correct
72 Correct 1 ms 212 KB Output is correct
73 Correct 1 ms 212 KB Output is correct
74 Correct 1 ms 212 KB Output is correct
75 Correct 1 ms 300 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 1 ms 212 KB Output is correct
79 Correct 1 ms 296 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 296 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 1 ms 212 KB Output is correct
84 Correct 1 ms 212 KB Output is correct
85 Correct 1 ms 212 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 244 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 0 ms 212 KB Output is correct
91 Correct 0 ms 212 KB Output is correct
92 Correct 1 ms 212 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 1 ms 212 KB Output is correct
95 Correct 1 ms 340 KB Output is correct
96 Correct 1 ms 340 KB Output is correct
97 Correct 1 ms 340 KB Output is correct
98 Correct 0 ms 300 KB Output is correct
99 Correct 1 ms 300 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 300 KB Output is correct
102 Correct 1 ms 300 KB Output is correct
103 Correct 1 ms 212 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 1 ms 212 KB Output is correct
106 Correct 1 ms 212 KB Output is correct
107 Correct 1 ms 328 KB Output is correct
108 Correct 2 ms 216 KB Output is correct
109 Correct 3 ms 340 KB Output is correct
110 Correct 22 ms 692 KB Output is correct
111 Correct 49 ms 1332 KB Output is correct
112 Correct 18 ms 1368 KB Output is correct
113 Correct 105 ms 1468 KB Output is correct
114 Correct 97 ms 2260 KB Output is correct
115 Correct 94 ms 2252 KB Output is correct
116 Correct 289 ms 1096 KB Output is correct
117 Correct 22 ms 1140 KB Output is correct
118 Correct 22 ms 852 KB Output is correct
119 Correct 793 ms 2408 KB Output is correct
120 Correct 46 ms 3536 KB Output is correct
121 Correct 357 ms 3524 KB Output is correct
122 Correct 376 ms 4976 KB Output is correct
123 Correct 359 ms 5008 KB Output is correct
124 Correct 1601 ms 7944 KB Output is correct
125 Execution timed out 2083 ms 18956 KB Time limit exceeded
126 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 304 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 23 ms 840 KB Output is correct
20 Correct 27 ms 4480 KB Output is correct
21 Correct 18 ms 1380 KB Output is correct
22 Correct 23 ms 904 KB Output is correct
23 Correct 20 ms 820 KB Output is correct
24 Correct 20 ms 5576 KB Output is correct
25 Correct 31 ms 5628 KB Output is correct
26 Correct 22 ms 1168 KB Output is correct
27 Correct 23 ms 908 KB Output is correct
28 Correct 21 ms 852 KB Output is correct
29 Correct 58 ms 1480 KB Output is correct
30 Correct 31 ms 3192 KB Output is correct
31 Correct 48 ms 3532 KB Output is correct
32 Correct 60 ms 1584 KB Output is correct
33 Correct 59 ms 1484 KB Output is correct
34 Correct 57 ms 16996 KB Output is correct
35 Correct 81 ms 17056 KB Output is correct
36 Correct 59 ms 1928 KB Output is correct
37 Correct 60 ms 1692 KB Output is correct
38 Correct 56 ms 1492 KB Output is correct
39 Correct 820 ms 11756 KB Output is correct
40 Correct 72 ms 2336 KB Output is correct
41 Correct 76 ms 17172 KB Output is correct
42 Correct 94 ms 2044 KB Output is correct
43 Correct 131 ms 11788 KB Output is correct
44 Correct 335 ms 15212 KB Output is correct
45 Correct 430 ms 18672 KB Output is correct
46 Correct 632 ms 28160 KB Output is correct
47 Correct 747 ms 11980 KB Output is correct
48 Correct 730 ms 11684 KB Output is correct
49 Correct 560 ms 135248 KB Output is correct
50 Correct 861 ms 135344 KB Output is correct
51 Correct 737 ms 13668 KB Output is correct
52 Correct 749 ms 12480 KB Output is correct
53 Correct 716 ms 11844 KB Output is correct
54 Correct 0 ms 212 KB Output is correct
55 Correct 0 ms 212 KB Output is correct
56 Correct 0 ms 212 KB Output is correct
57 Correct 0 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 296 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 1 ms 340 KB Output is correct
68 Correct 1 ms 340 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 1 ms 300 KB Output is correct
72 Correct 1 ms 212 KB Output is correct
73 Correct 1 ms 212 KB Output is correct
74 Correct 1 ms 212 KB Output is correct
75 Correct 1 ms 300 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 1 ms 212 KB Output is correct
79 Correct 1 ms 296 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 296 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 1 ms 212 KB Output is correct
84 Correct 1 ms 212 KB Output is correct
85 Correct 1 ms 212 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 244 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 0 ms 212 KB Output is correct
91 Correct 0 ms 212 KB Output is correct
92 Correct 1 ms 212 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 1 ms 212 KB Output is correct
95 Correct 1 ms 340 KB Output is correct
96 Correct 1 ms 340 KB Output is correct
97 Correct 1 ms 340 KB Output is correct
98 Correct 0 ms 300 KB Output is correct
99 Correct 1 ms 300 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 300 KB Output is correct
102 Correct 1 ms 300 KB Output is correct
103 Correct 1 ms 212 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 1 ms 212 KB Output is correct
106 Correct 1 ms 212 KB Output is correct
107 Correct 1 ms 328 KB Output is correct
108 Correct 2 ms 216 KB Output is correct
109 Correct 3 ms 340 KB Output is correct
110 Correct 22 ms 692 KB Output is correct
111 Correct 49 ms 1332 KB Output is correct
112 Correct 18 ms 1368 KB Output is correct
113 Correct 105 ms 1468 KB Output is correct
114 Correct 97 ms 2260 KB Output is correct
115 Correct 94 ms 2252 KB Output is correct
116 Correct 289 ms 1096 KB Output is correct
117 Correct 22 ms 1140 KB Output is correct
118 Correct 22 ms 852 KB Output is correct
119 Correct 793 ms 2408 KB Output is correct
120 Correct 46 ms 3536 KB Output is correct
121 Correct 357 ms 3524 KB Output is correct
122 Correct 376 ms 4976 KB Output is correct
123 Correct 359 ms 5008 KB Output is correct
124 Correct 1601 ms 7944 KB Output is correct
125 Execution timed out 2083 ms 18956 KB Time limit exceeded
126 Halted 0 ms 0 KB -