Submission #1105450

# Submission time Handle Problem Language Result Execution time Memory
1105450 2024-10-26T12:45:49 Z duckindog Maze (JOI23_ho_t3) C++17
86 / 100
2000 ms 561160 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>

using namespace std;

const int dx[] = {1, 0, -1, 0},
          dy[] = {0, 1, 0, -1};

struct DSU { 
  vector<int> id;
  DSU(int n) : id(n, -1) {}
  int root(int u) { return id[u] < 0 ? u : id[u] = root(id[u]); }
  void add(int u, int v) { 
    u = root(u); v = root(v);
    if (u == v) return;
    id[u] += id[v];
    id[v] = u;
  }
};

int32_t main() { 
  cin.tie(0)->sync_with_stdio(0);

  int r, c, n; cin >> r >> c >> n;
  int Sr, Sc; cin >> Sr >> Sc;
  int Gr, Gc; cin >> Gr >> Gc;

  vector<vector<char>> a(r + 10, vector<char>(c + 10));
  for (int i = 1; i <= r; ++i) { 
    for (int j = 1; j <= c; ++j) cin >> a[i][j];
  }
  auto in = [&](int x, int y) { return 1 <= x && x <= r && 1 <= y && y <= c; };

  vector<DSU> R(r + 10, DSU(c + 10));
  vector<DSU> C(c + 10, DSU(r + 10));
  
  vector<vector<int>> f(r + 10, vector<int>(c + 10, 1'000'000'000));
  deque<pair<int, int>> q;
  q.push_back({Sr, Sc});
  f[Sr][Sc] = 0;
  while (q.size()) { 
    auto [x, y] = q.front(); q.pop_front();
    auto add = [&](int nX, int nY, int w) { 
      if (f[nX][nY] > f[x][y] + w) { 
        f[nX][nY] = f[x][y] + w;

        if (w) q.push_back({nX, nY});
        else q.push_front({nX, nY});
      }
    };

    for (int t = 0; t < 4; ++t) { 
      int nX = x + dx[t], nY = y + dy[t];
      if (!in(nX, nY) || a[nX][nY] == '#') continue;
      add(nX, nY, 0);
    }

    { //add a fricking regtangle
      int stX = max(1, x - n + 1), edX = min(r, x + n - 1);
      int stY = max(1, y - n), edY = min(c, y + n);
      
      for (int h = stX; h <= edX; h = C[stY].root(h)) {
        add(h, stY, 1);  
        for (int i = R[h].root(stY); i < edY; i = R[h].root(i)) {
          R[h].add(R[h].root(i) + 1, R[h].root(i));
          add(h, R[h].root(i), 1);
        }
        if (R[h].root(stY) - stY >= 2 * n + 1 || R[h].root(stY) == c) C[stY].add(h + 1, h);
        h += 1;
      }
    }

    { //add 2 fricking strips due to the rectangle is not the fucking square
      int stX = max(1, x - n), edX = min(r, x + n);
      int stY = max(1, y - n + 1), edY = min(c, y + n - 1);
      
      for (int type = 0; type < 2; ++type) { 
        int h = (!type ? stX : edX);
        
        add(h, stY, 1);
        for (int i = R[h].root(stY); i < edY; i = R[h].root(i)) {
          R[h].add(R[h].root(i) + 1, R[h].root(i));
          add(h, R[h].root(i), 1);
        }
        if (R[h].root(stY) - stY >= 2 * n + 1 || R[h].root(stY) == c) C[stY].add(h + 1, h);
      }
    }
  }

  cout << f[Gr][Gc] << "\n";
  cerr << 1.0 * clock() / CLOCKS_PER_SEC << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 6 ms 1104 KB Output is correct
20 Correct 14 ms 9112 KB Output is correct
21 Correct 6 ms 1556 KB Output is correct
22 Correct 11 ms 1104 KB Output is correct
23 Correct 6 ms 1268 KB Output is correct
24 Correct 15 ms 11692 KB Output is correct
25 Correct 13 ms 11620 KB Output is correct
26 Correct 9 ms 1360 KB Output is correct
27 Correct 9 ms 1104 KB Output is correct
28 Correct 5 ms 1104 KB Output is correct
29 Correct 14 ms 2384 KB Output is correct
30 Correct 11 ms 6480 KB Output is correct
31 Correct 13 ms 3152 KB Output is correct
32 Correct 29 ms 2540 KB Output is correct
33 Correct 13 ms 2384 KB Output is correct
34 Correct 28 ms 28528 KB Output is correct
35 Correct 29 ms 28544 KB Output is correct
36 Correct 19 ms 2384 KB Output is correct
37 Correct 19 ms 2384 KB Output is correct
38 Correct 13 ms 2384 KB Output is correct
39 Correct 150 ms 20044 KB Output is correct
40 Correct 22 ms 4176 KB Output is correct
41 Correct 41 ms 34748 KB Output is correct
42 Correct 23 ms 3408 KB Output is correct
43 Correct 35 ms 24180 KB Output is correct
44 Correct 97 ms 30732 KB Output is correct
45 Correct 91 ms 38452 KB Output is correct
46 Correct 115 ms 26184 KB Output is correct
47 Correct 197 ms 20040 KB Output is correct
48 Correct 139 ms 20040 KB Output is correct
49 Correct 212 ms 280900 KB Output is correct
50 Correct 225 ms 280744 KB Output is correct
51 Correct 191 ms 20048 KB Output is correct
52 Correct 195 ms 20216 KB Output is correct
53 Correct 139 ms 20048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 508 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 508 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 592 KB Output is correct
16 Correct 1 ms 592 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 508 KB Output is correct
26 Correct 2 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 416 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 592 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 2 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 7 ms 848 KB Output is correct
26 Correct 12 ms 2040 KB Output is correct
27 Correct 6 ms 1360 KB Output is correct
28 Correct 9 ms 2048 KB Output is correct
29 Correct 8 ms 1616 KB Output is correct
30 Correct 6 ms 1616 KB Output is correct
31 Correct 29 ms 1528 KB Output is correct
32 Correct 8 ms 1360 KB Output is correct
33 Correct 8 ms 1104 KB Output is correct
34 Correct 22 ms 3152 KB Output is correct
35 Correct 12 ms 3152 KB Output is correct
36 Correct 20 ms 4136 KB Output is correct
37 Correct 15 ms 3836 KB Output is correct
38 Correct 12 ms 3664 KB Output is correct
39 Correct 86 ms 10144 KB Output is correct
40 Correct 223 ms 30548 KB Output is correct
41 Correct 116 ms 26184 KB Output is correct
42 Correct 192 ms 38360 KB Output is correct
43 Correct 145 ms 32216 KB Output is correct
44 Correct 114 ms 32332 KB Output is correct
45 Correct 251 ms 35524 KB Output is correct
46 Correct 250 ms 34516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 508 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 508 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 592 KB Output is correct
16 Correct 1 ms 592 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 508 KB Output is correct
26 Correct 2 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 6 ms 1276 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 1 ms 848 KB Output is correct
36 Correct 7 ms 1068 KB Output is correct
37 Correct 10 ms 9112 KB Output is correct
38 Correct 11 ms 1872 KB Output is correct
39 Correct 5 ms 1360 KB Output is correct
40 Correct 8 ms 1104 KB Output is correct
41 Correct 5 ms 1104 KB Output is correct
42 Correct 9 ms 1872 KB Output is correct
43 Correct 7 ms 1616 KB Output is correct
44 Correct 5 ms 1616 KB Output is correct
45 Correct 13 ms 11620 KB Output is correct
46 Correct 14 ms 11476 KB Output is correct
47 Correct 16 ms 6224 KB Output is correct
48 Correct 11 ms 1872 KB Output is correct
49 Correct 12 ms 1616 KB Output is correct
50 Correct 23 ms 1360 KB Output is correct
51 Correct 30 ms 1360 KB Output is correct
52 Correct 9 ms 1360 KB Output is correct
53 Correct 12 ms 1348 KB Output is correct
54 Correct 9 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 508 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 508 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 592 KB Output is correct
16 Correct 1 ms 592 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
23 Correct 1 ms 336 KB Output is correct
24 Correct 1 ms 336 KB Output is correct
25 Correct 1 ms 508 KB Output is correct
26 Correct 2 ms 336 KB Output is correct
27 Correct 1 ms 336 KB Output is correct
28 Correct 1 ms 336 KB Output is correct
29 Correct 1 ms 336 KB Output is correct
30 Correct 1 ms 336 KB Output is correct
31 Correct 1 ms 336 KB Output is correct
32 Correct 1 ms 336 KB Output is correct
33 Correct 6 ms 1276 KB Output is correct
34 Correct 1 ms 336 KB Output is correct
35 Correct 1 ms 848 KB Output is correct
36 Correct 7 ms 1068 KB Output is correct
37 Correct 10 ms 9112 KB Output is correct
38 Correct 11 ms 1872 KB Output is correct
39 Correct 5 ms 1360 KB Output is correct
40 Correct 8 ms 1104 KB Output is correct
41 Correct 5 ms 1104 KB Output is correct
42 Correct 9 ms 1872 KB Output is correct
43 Correct 7 ms 1616 KB Output is correct
44 Correct 5 ms 1616 KB Output is correct
45 Correct 13 ms 11620 KB Output is correct
46 Correct 14 ms 11476 KB Output is correct
47 Correct 16 ms 6224 KB Output is correct
48 Correct 11 ms 1872 KB Output is correct
49 Correct 12 ms 1616 KB Output is correct
50 Correct 23 ms 1360 KB Output is correct
51 Correct 30 ms 1360 KB Output is correct
52 Correct 9 ms 1360 KB Output is correct
53 Correct 12 ms 1348 KB Output is correct
54 Correct 9 ms 1104 KB Output is correct
55 Correct 14 ms 2384 KB Output is correct
56 Correct 11 ms 6480 KB Output is correct
57 Correct 25 ms 3304 KB Output is correct
58 Correct 25 ms 3920 KB Output is correct
59 Correct 12 ms 3152 KB Output is correct
60 Correct 20 ms 2384 KB Output is correct
61 Correct 14 ms 2384 KB Output is correct
62 Correct 22 ms 4176 KB Output is correct
63 Correct 17 ms 3664 KB Output is correct
64 Correct 13 ms 3664 KB Output is correct
65 Correct 31 ms 28528 KB Output is correct
66 Correct 32 ms 28528 KB Output is correct
67 Correct 25 ms 15164 KB Output is correct
68 Correct 35 ms 3624 KB Output is correct
69 Correct 45 ms 3328 KB Output is correct
70 Correct 23 ms 2896 KB Output is correct
71 Correct 91 ms 2896 KB Output is correct
72 Correct 23 ms 2584 KB Output is correct
73 Correct 22 ms 2384 KB Output is correct
74 Correct 13 ms 2384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 6 ms 1104 KB Output is correct
20 Correct 14 ms 9112 KB Output is correct
21 Correct 6 ms 1556 KB Output is correct
22 Correct 11 ms 1104 KB Output is correct
23 Correct 6 ms 1268 KB Output is correct
24 Correct 15 ms 11692 KB Output is correct
25 Correct 13 ms 11620 KB Output is correct
26 Correct 9 ms 1360 KB Output is correct
27 Correct 9 ms 1104 KB Output is correct
28 Correct 5 ms 1104 KB Output is correct
29 Correct 14 ms 2384 KB Output is correct
30 Correct 11 ms 6480 KB Output is correct
31 Correct 13 ms 3152 KB Output is correct
32 Correct 29 ms 2540 KB Output is correct
33 Correct 13 ms 2384 KB Output is correct
34 Correct 28 ms 28528 KB Output is correct
35 Correct 29 ms 28544 KB Output is correct
36 Correct 19 ms 2384 KB Output is correct
37 Correct 19 ms 2384 KB Output is correct
38 Correct 13 ms 2384 KB Output is correct
39 Correct 150 ms 20044 KB Output is correct
40 Correct 22 ms 4176 KB Output is correct
41 Correct 41 ms 34748 KB Output is correct
42 Correct 23 ms 3408 KB Output is correct
43 Correct 35 ms 24180 KB Output is correct
44 Correct 97 ms 30732 KB Output is correct
45 Correct 91 ms 38452 KB Output is correct
46 Correct 115 ms 26184 KB Output is correct
47 Correct 197 ms 20040 KB Output is correct
48 Correct 139 ms 20040 KB Output is correct
49 Correct 212 ms 280900 KB Output is correct
50 Correct 225 ms 280744 KB Output is correct
51 Correct 191 ms 20048 KB Output is correct
52 Correct 195 ms 20216 KB Output is correct
53 Correct 139 ms 20048 KB Output is correct
54 Correct 1 ms 508 KB Output is correct
55 Correct 1 ms 336 KB Output is correct
56 Correct 1 ms 336 KB Output is correct
57 Correct 1 ms 336 KB Output is correct
58 Correct 1 ms 336 KB Output is correct
59 Correct 1 ms 336 KB Output is correct
60 Correct 1 ms 336 KB Output is correct
61 Correct 1 ms 336 KB Output is correct
62 Correct 1 ms 336 KB Output is correct
63 Correct 1 ms 336 KB Output is correct
64 Correct 1 ms 508 KB Output is correct
65 Correct 1 ms 336 KB Output is correct
66 Correct 1 ms 336 KB Output is correct
67 Correct 1 ms 336 KB Output is correct
68 Correct 1 ms 592 KB Output is correct
69 Correct 1 ms 592 KB Output is correct
70 Correct 1 ms 336 KB Output is correct
71 Correct 1 ms 336 KB Output is correct
72 Correct 1 ms 336 KB Output is correct
73 Correct 1 ms 336 KB Output is correct
74 Correct 1 ms 336 KB Output is correct
75 Correct 1 ms 336 KB Output is correct
76 Correct 1 ms 336 KB Output is correct
77 Correct 1 ms 336 KB Output is correct
78 Correct 1 ms 508 KB Output is correct
79 Correct 2 ms 336 KB Output is correct
80 Correct 1 ms 336 KB Output is correct
81 Correct 1 ms 336 KB Output is correct
82 Correct 1 ms 336 KB Output is correct
83 Correct 1 ms 336 KB Output is correct
84 Correct 1 ms 336 KB Output is correct
85 Correct 1 ms 336 KB Output is correct
86 Correct 1 ms 336 KB Output is correct
87 Correct 1 ms 504 KB Output is correct
88 Correct 1 ms 336 KB Output is correct
89 Correct 1 ms 336 KB Output is correct
90 Correct 1 ms 336 KB Output is correct
91 Correct 1 ms 336 KB Output is correct
92 Correct 1 ms 336 KB Output is correct
93 Correct 1 ms 336 KB Output is correct
94 Correct 1 ms 336 KB Output is correct
95 Correct 1 ms 416 KB Output is correct
96 Correct 1 ms 336 KB Output is correct
97 Correct 1 ms 592 KB Output is correct
98 Correct 1 ms 336 KB Output is correct
99 Correct 1 ms 336 KB Output is correct
100 Correct 1 ms 336 KB Output is correct
101 Correct 1 ms 336 KB Output is correct
102 Correct 1 ms 336 KB Output is correct
103 Correct 1 ms 336 KB Output is correct
104 Correct 1 ms 336 KB Output is correct
105 Correct 1 ms 336 KB Output is correct
106 Correct 1 ms 336 KB Output is correct
107 Correct 2 ms 336 KB Output is correct
108 Correct 1 ms 336 KB Output is correct
109 Correct 1 ms 336 KB Output is correct
110 Correct 7 ms 848 KB Output is correct
111 Correct 12 ms 2040 KB Output is correct
112 Correct 6 ms 1360 KB Output is correct
113 Correct 9 ms 2048 KB Output is correct
114 Correct 8 ms 1616 KB Output is correct
115 Correct 6 ms 1616 KB Output is correct
116 Correct 29 ms 1528 KB Output is correct
117 Correct 8 ms 1360 KB Output is correct
118 Correct 8 ms 1104 KB Output is correct
119 Correct 22 ms 3152 KB Output is correct
120 Correct 12 ms 3152 KB Output is correct
121 Correct 20 ms 4136 KB Output is correct
122 Correct 15 ms 3836 KB Output is correct
123 Correct 12 ms 3664 KB Output is correct
124 Correct 86 ms 10144 KB Output is correct
125 Correct 223 ms 30548 KB Output is correct
126 Correct 116 ms 26184 KB Output is correct
127 Correct 192 ms 38360 KB Output is correct
128 Correct 145 ms 32216 KB Output is correct
129 Correct 114 ms 32332 KB Output is correct
130 Correct 251 ms 35524 KB Output is correct
131 Correct 250 ms 34516 KB Output is correct
132 Correct 6 ms 1276 KB Output is correct
133 Correct 1 ms 336 KB Output is correct
134 Correct 1 ms 848 KB Output is correct
135 Correct 7 ms 1068 KB Output is correct
136 Correct 10 ms 9112 KB Output is correct
137 Correct 11 ms 1872 KB Output is correct
138 Correct 5 ms 1360 KB Output is correct
139 Correct 8 ms 1104 KB Output is correct
140 Correct 5 ms 1104 KB Output is correct
141 Correct 9 ms 1872 KB Output is correct
142 Correct 7 ms 1616 KB Output is correct
143 Correct 5 ms 1616 KB Output is correct
144 Correct 13 ms 11620 KB Output is correct
145 Correct 14 ms 11476 KB Output is correct
146 Correct 16 ms 6224 KB Output is correct
147 Correct 11 ms 1872 KB Output is correct
148 Correct 12 ms 1616 KB Output is correct
149 Correct 23 ms 1360 KB Output is correct
150 Correct 30 ms 1360 KB Output is correct
151 Correct 9 ms 1360 KB Output is correct
152 Correct 12 ms 1348 KB Output is correct
153 Correct 9 ms 1104 KB Output is correct
154 Correct 14 ms 2384 KB Output is correct
155 Correct 11 ms 6480 KB Output is correct
156 Correct 25 ms 3304 KB Output is correct
157 Correct 25 ms 3920 KB Output is correct
158 Correct 12 ms 3152 KB Output is correct
159 Correct 20 ms 2384 KB Output is correct
160 Correct 14 ms 2384 KB Output is correct
161 Correct 22 ms 4176 KB Output is correct
162 Correct 17 ms 3664 KB Output is correct
163 Correct 13 ms 3664 KB Output is correct
164 Correct 31 ms 28528 KB Output is correct
165 Correct 32 ms 28528 KB Output is correct
166 Correct 25 ms 15164 KB Output is correct
167 Correct 35 ms 3624 KB Output is correct
168 Correct 45 ms 3328 KB Output is correct
169 Correct 23 ms 2896 KB Output is correct
170 Correct 91 ms 2896 KB Output is correct
171 Correct 23 ms 2584 KB Output is correct
172 Correct 22 ms 2384 KB Output is correct
173 Correct 13 ms 2384 KB Output is correct
174 Correct 41 ms 5572 KB Output is correct
175 Correct 118 ms 5848 KB Output is correct
176 Correct 129 ms 52504 KB Output is correct
177 Correct 202 ms 21036 KB Output is correct
178 Correct 292 ms 23228 KB Output is correct
179 Correct 740 ms 25380 KB Output is correct
180 Correct 737 ms 22856 KB Output is correct
181 Correct 624 ms 22192 KB Output is correct
182 Correct 897 ms 22084 KB Output is correct
183 Correct 267 ms 26984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 6 ms 1104 KB Output is correct
20 Correct 14 ms 9112 KB Output is correct
21 Correct 6 ms 1556 KB Output is correct
22 Correct 11 ms 1104 KB Output is correct
23 Correct 6 ms 1268 KB Output is correct
24 Correct 15 ms 11692 KB Output is correct
25 Correct 13 ms 11620 KB Output is correct
26 Correct 9 ms 1360 KB Output is correct
27 Correct 9 ms 1104 KB Output is correct
28 Correct 5 ms 1104 KB Output is correct
29 Correct 14 ms 2384 KB Output is correct
30 Correct 11 ms 6480 KB Output is correct
31 Correct 13 ms 3152 KB Output is correct
32 Correct 29 ms 2540 KB Output is correct
33 Correct 13 ms 2384 KB Output is correct
34 Correct 28 ms 28528 KB Output is correct
35 Correct 29 ms 28544 KB Output is correct
36 Correct 19 ms 2384 KB Output is correct
37 Correct 19 ms 2384 KB Output is correct
38 Correct 13 ms 2384 KB Output is correct
39 Correct 150 ms 20044 KB Output is correct
40 Correct 22 ms 4176 KB Output is correct
41 Correct 41 ms 34748 KB Output is correct
42 Correct 23 ms 3408 KB Output is correct
43 Correct 35 ms 24180 KB Output is correct
44 Correct 97 ms 30732 KB Output is correct
45 Correct 91 ms 38452 KB Output is correct
46 Correct 115 ms 26184 KB Output is correct
47 Correct 197 ms 20040 KB Output is correct
48 Correct 139 ms 20040 KB Output is correct
49 Correct 212 ms 280900 KB Output is correct
50 Correct 225 ms 280744 KB Output is correct
51 Correct 191 ms 20048 KB Output is correct
52 Correct 195 ms 20216 KB Output is correct
53 Correct 139 ms 20048 KB Output is correct
54 Correct 1 ms 508 KB Output is correct
55 Correct 1 ms 336 KB Output is correct
56 Correct 1 ms 336 KB Output is correct
57 Correct 1 ms 336 KB Output is correct
58 Correct 1 ms 336 KB Output is correct
59 Correct 1 ms 336 KB Output is correct
60 Correct 1 ms 336 KB Output is correct
61 Correct 1 ms 336 KB Output is correct
62 Correct 1 ms 336 KB Output is correct
63 Correct 1 ms 336 KB Output is correct
64 Correct 1 ms 508 KB Output is correct
65 Correct 1 ms 336 KB Output is correct
66 Correct 1 ms 336 KB Output is correct
67 Correct 1 ms 336 KB Output is correct
68 Correct 1 ms 592 KB Output is correct
69 Correct 1 ms 592 KB Output is correct
70 Correct 1 ms 336 KB Output is correct
71 Correct 1 ms 336 KB Output is correct
72 Correct 1 ms 336 KB Output is correct
73 Correct 1 ms 336 KB Output is correct
74 Correct 1 ms 336 KB Output is correct
75 Correct 1 ms 336 KB Output is correct
76 Correct 1 ms 336 KB Output is correct
77 Correct 1 ms 336 KB Output is correct
78 Correct 1 ms 508 KB Output is correct
79 Correct 2 ms 336 KB Output is correct
80 Correct 1 ms 336 KB Output is correct
81 Correct 1 ms 336 KB Output is correct
82 Correct 1 ms 336 KB Output is correct
83 Correct 1 ms 336 KB Output is correct
84 Correct 1 ms 336 KB Output is correct
85 Correct 1 ms 336 KB Output is correct
86 Correct 1 ms 336 KB Output is correct
87 Correct 1 ms 504 KB Output is correct
88 Correct 1 ms 336 KB Output is correct
89 Correct 1 ms 336 KB Output is correct
90 Correct 1 ms 336 KB Output is correct
91 Correct 1 ms 336 KB Output is correct
92 Correct 1 ms 336 KB Output is correct
93 Correct 1 ms 336 KB Output is correct
94 Correct 1 ms 336 KB Output is correct
95 Correct 1 ms 416 KB Output is correct
96 Correct 1 ms 336 KB Output is correct
97 Correct 1 ms 592 KB Output is correct
98 Correct 1 ms 336 KB Output is correct
99 Correct 1 ms 336 KB Output is correct
100 Correct 1 ms 336 KB Output is correct
101 Correct 1 ms 336 KB Output is correct
102 Correct 1 ms 336 KB Output is correct
103 Correct 1 ms 336 KB Output is correct
104 Correct 1 ms 336 KB Output is correct
105 Correct 1 ms 336 KB Output is correct
106 Correct 1 ms 336 KB Output is correct
107 Correct 2 ms 336 KB Output is correct
108 Correct 1 ms 336 KB Output is correct
109 Correct 1 ms 336 KB Output is correct
110 Correct 7 ms 848 KB Output is correct
111 Correct 12 ms 2040 KB Output is correct
112 Correct 6 ms 1360 KB Output is correct
113 Correct 9 ms 2048 KB Output is correct
114 Correct 8 ms 1616 KB Output is correct
115 Correct 6 ms 1616 KB Output is correct
116 Correct 29 ms 1528 KB Output is correct
117 Correct 8 ms 1360 KB Output is correct
118 Correct 8 ms 1104 KB Output is correct
119 Correct 22 ms 3152 KB Output is correct
120 Correct 12 ms 3152 KB Output is correct
121 Correct 20 ms 4136 KB Output is correct
122 Correct 15 ms 3836 KB Output is correct
123 Correct 12 ms 3664 KB Output is correct
124 Correct 86 ms 10144 KB Output is correct
125 Correct 223 ms 30548 KB Output is correct
126 Correct 116 ms 26184 KB Output is correct
127 Correct 192 ms 38360 KB Output is correct
128 Correct 145 ms 32216 KB Output is correct
129 Correct 114 ms 32332 KB Output is correct
130 Correct 251 ms 35524 KB Output is correct
131 Correct 250 ms 34516 KB Output is correct
132 Correct 6 ms 1276 KB Output is correct
133 Correct 1 ms 336 KB Output is correct
134 Correct 1 ms 848 KB Output is correct
135 Correct 7 ms 1068 KB Output is correct
136 Correct 10 ms 9112 KB Output is correct
137 Correct 11 ms 1872 KB Output is correct
138 Correct 5 ms 1360 KB Output is correct
139 Correct 8 ms 1104 KB Output is correct
140 Correct 5 ms 1104 KB Output is correct
141 Correct 9 ms 1872 KB Output is correct
142 Correct 7 ms 1616 KB Output is correct
143 Correct 5 ms 1616 KB Output is correct
144 Correct 13 ms 11620 KB Output is correct
145 Correct 14 ms 11476 KB Output is correct
146 Correct 16 ms 6224 KB Output is correct
147 Correct 11 ms 1872 KB Output is correct
148 Correct 12 ms 1616 KB Output is correct
149 Correct 23 ms 1360 KB Output is correct
150 Correct 30 ms 1360 KB Output is correct
151 Correct 9 ms 1360 KB Output is correct
152 Correct 12 ms 1348 KB Output is correct
153 Correct 9 ms 1104 KB Output is correct
154 Correct 14 ms 2384 KB Output is correct
155 Correct 11 ms 6480 KB Output is correct
156 Correct 25 ms 3304 KB Output is correct
157 Correct 25 ms 3920 KB Output is correct
158 Correct 12 ms 3152 KB Output is correct
159 Correct 20 ms 2384 KB Output is correct
160 Correct 14 ms 2384 KB Output is correct
161 Correct 22 ms 4176 KB Output is correct
162 Correct 17 ms 3664 KB Output is correct
163 Correct 13 ms 3664 KB Output is correct
164 Correct 31 ms 28528 KB Output is correct
165 Correct 32 ms 28528 KB Output is correct
166 Correct 25 ms 15164 KB Output is correct
167 Correct 35 ms 3624 KB Output is correct
168 Correct 45 ms 3328 KB Output is correct
169 Correct 23 ms 2896 KB Output is correct
170 Correct 91 ms 2896 KB Output is correct
171 Correct 23 ms 2584 KB Output is correct
172 Correct 22 ms 2384 KB Output is correct
173 Correct 13 ms 2384 KB Output is correct
174 Correct 41 ms 5572 KB Output is correct
175 Correct 118 ms 5848 KB Output is correct
176 Correct 129 ms 52504 KB Output is correct
177 Correct 202 ms 21036 KB Output is correct
178 Correct 292 ms 23228 KB Output is correct
179 Correct 740 ms 25380 KB Output is correct
180 Correct 737 ms 22856 KB Output is correct
181 Correct 624 ms 22192 KB Output is correct
182 Correct 897 ms 22084 KB Output is correct
183 Correct 267 ms 26984 KB Output is correct
184 Correct 305 ms 39240 KB Output is correct
185 Correct 293 ms 29584 KB Output is correct
186 Correct 368 ms 40008 KB Output is correct
187 Correct 475 ms 29172 KB Output is correct
188 Correct 235 ms 51672 KB Output is correct
189 Correct 403 ms 39240 KB Output is correct
190 Correct 298 ms 39076 KB Output is correct
191 Correct 468 ms 76272 KB Output is correct
192 Correct 329 ms 63740 KB Output is correct
193 Correct 263 ms 63840 KB Output is correct
194 Correct 461 ms 561156 KB Output is correct
195 Correct 446 ms 561160 KB Output is correct
196 Correct 537 ms 47956 KB Output is correct
197 Correct 462 ms 44628 KB Output is correct
198 Execution timed out 2069 ms 42568 KB Time limit exceeded
199 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 592 KB Output is correct
8 Correct 1 ms 592 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 336 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 336 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 6 ms 1104 KB Output is correct
20 Correct 14 ms 9112 KB Output is correct
21 Correct 6 ms 1556 KB Output is correct
22 Correct 11 ms 1104 KB Output is correct
23 Correct 6 ms 1268 KB Output is correct
24 Correct 15 ms 11692 KB Output is correct
25 Correct 13 ms 11620 KB Output is correct
26 Correct 9 ms 1360 KB Output is correct
27 Correct 9 ms 1104 KB Output is correct
28 Correct 5 ms 1104 KB Output is correct
29 Correct 14 ms 2384 KB Output is correct
30 Correct 11 ms 6480 KB Output is correct
31 Correct 13 ms 3152 KB Output is correct
32 Correct 29 ms 2540 KB Output is correct
33 Correct 13 ms 2384 KB Output is correct
34 Correct 28 ms 28528 KB Output is correct
35 Correct 29 ms 28544 KB Output is correct
36 Correct 19 ms 2384 KB Output is correct
37 Correct 19 ms 2384 KB Output is correct
38 Correct 13 ms 2384 KB Output is correct
39 Correct 150 ms 20044 KB Output is correct
40 Correct 22 ms 4176 KB Output is correct
41 Correct 41 ms 34748 KB Output is correct
42 Correct 23 ms 3408 KB Output is correct
43 Correct 35 ms 24180 KB Output is correct
44 Correct 97 ms 30732 KB Output is correct
45 Correct 91 ms 38452 KB Output is correct
46 Correct 115 ms 26184 KB Output is correct
47 Correct 197 ms 20040 KB Output is correct
48 Correct 139 ms 20040 KB Output is correct
49 Correct 212 ms 280900 KB Output is correct
50 Correct 225 ms 280744 KB Output is correct
51 Correct 191 ms 20048 KB Output is correct
52 Correct 195 ms 20216 KB Output is correct
53 Correct 139 ms 20048 KB Output is correct
54 Correct 1 ms 508 KB Output is correct
55 Correct 1 ms 336 KB Output is correct
56 Correct 1 ms 336 KB Output is correct
57 Correct 1 ms 336 KB Output is correct
58 Correct 1 ms 336 KB Output is correct
59 Correct 1 ms 336 KB Output is correct
60 Correct 1 ms 336 KB Output is correct
61 Correct 1 ms 336 KB Output is correct
62 Correct 1 ms 336 KB Output is correct
63 Correct 1 ms 336 KB Output is correct
64 Correct 1 ms 508 KB Output is correct
65 Correct 1 ms 336 KB Output is correct
66 Correct 1 ms 336 KB Output is correct
67 Correct 1 ms 336 KB Output is correct
68 Correct 1 ms 592 KB Output is correct
69 Correct 1 ms 592 KB Output is correct
70 Correct 1 ms 336 KB Output is correct
71 Correct 1 ms 336 KB Output is correct
72 Correct 1 ms 336 KB Output is correct
73 Correct 1 ms 336 KB Output is correct
74 Correct 1 ms 336 KB Output is correct
75 Correct 1 ms 336 KB Output is correct
76 Correct 1 ms 336 KB Output is correct
77 Correct 1 ms 336 KB Output is correct
78 Correct 1 ms 508 KB Output is correct
79 Correct 2 ms 336 KB Output is correct
80 Correct 1 ms 336 KB Output is correct
81 Correct 1 ms 336 KB Output is correct
82 Correct 1 ms 336 KB Output is correct
83 Correct 1 ms 336 KB Output is correct
84 Correct 1 ms 336 KB Output is correct
85 Correct 1 ms 336 KB Output is correct
86 Correct 1 ms 336 KB Output is correct
87 Correct 1 ms 504 KB Output is correct
88 Correct 1 ms 336 KB Output is correct
89 Correct 1 ms 336 KB Output is correct
90 Correct 1 ms 336 KB Output is correct
91 Correct 1 ms 336 KB Output is correct
92 Correct 1 ms 336 KB Output is correct
93 Correct 1 ms 336 KB Output is correct
94 Correct 1 ms 336 KB Output is correct
95 Correct 1 ms 416 KB Output is correct
96 Correct 1 ms 336 KB Output is correct
97 Correct 1 ms 592 KB Output is correct
98 Correct 1 ms 336 KB Output is correct
99 Correct 1 ms 336 KB Output is correct
100 Correct 1 ms 336 KB Output is correct
101 Correct 1 ms 336 KB Output is correct
102 Correct 1 ms 336 KB Output is correct
103 Correct 1 ms 336 KB Output is correct
104 Correct 1 ms 336 KB Output is correct
105 Correct 1 ms 336 KB Output is correct
106 Correct 1 ms 336 KB Output is correct
107 Correct 2 ms 336 KB Output is correct
108 Correct 1 ms 336 KB Output is correct
109 Correct 1 ms 336 KB Output is correct
110 Correct 7 ms 848 KB Output is correct
111 Correct 12 ms 2040 KB Output is correct
112 Correct 6 ms 1360 KB Output is correct
113 Correct 9 ms 2048 KB Output is correct
114 Correct 8 ms 1616 KB Output is correct
115 Correct 6 ms 1616 KB Output is correct
116 Correct 29 ms 1528 KB Output is correct
117 Correct 8 ms 1360 KB Output is correct
118 Correct 8 ms 1104 KB Output is correct
119 Correct 22 ms 3152 KB Output is correct
120 Correct 12 ms 3152 KB Output is correct
121 Correct 20 ms 4136 KB Output is correct
122 Correct 15 ms 3836 KB Output is correct
123 Correct 12 ms 3664 KB Output is correct
124 Correct 86 ms 10144 KB Output is correct
125 Correct 223 ms 30548 KB Output is correct
126 Correct 116 ms 26184 KB Output is correct
127 Correct 192 ms 38360 KB Output is correct
128 Correct 145 ms 32216 KB Output is correct
129 Correct 114 ms 32332 KB Output is correct
130 Correct 251 ms 35524 KB Output is correct
131 Correct 250 ms 34516 KB Output is correct
132 Correct 6 ms 1276 KB Output is correct
133 Correct 1 ms 336 KB Output is correct
134 Correct 1 ms 848 KB Output is correct
135 Correct 7 ms 1068 KB Output is correct
136 Correct 10 ms 9112 KB Output is correct
137 Correct 11 ms 1872 KB Output is correct
138 Correct 5 ms 1360 KB Output is correct
139 Correct 8 ms 1104 KB Output is correct
140 Correct 5 ms 1104 KB Output is correct
141 Correct 9 ms 1872 KB Output is correct
142 Correct 7 ms 1616 KB Output is correct
143 Correct 5 ms 1616 KB Output is correct
144 Correct 13 ms 11620 KB Output is correct
145 Correct 14 ms 11476 KB Output is correct
146 Correct 16 ms 6224 KB Output is correct
147 Correct 11 ms 1872 KB Output is correct
148 Correct 12 ms 1616 KB Output is correct
149 Correct 23 ms 1360 KB Output is correct
150 Correct 30 ms 1360 KB Output is correct
151 Correct 9 ms 1360 KB Output is correct
152 Correct 12 ms 1348 KB Output is correct
153 Correct 9 ms 1104 KB Output is correct
154 Correct 14 ms 2384 KB Output is correct
155 Correct 11 ms 6480 KB Output is correct
156 Correct 25 ms 3304 KB Output is correct
157 Correct 25 ms 3920 KB Output is correct
158 Correct 12 ms 3152 KB Output is correct
159 Correct 20 ms 2384 KB Output is correct
160 Correct 14 ms 2384 KB Output is correct
161 Correct 22 ms 4176 KB Output is correct
162 Correct 17 ms 3664 KB Output is correct
163 Correct 13 ms 3664 KB Output is correct
164 Correct 31 ms 28528 KB Output is correct
165 Correct 32 ms 28528 KB Output is correct
166 Correct 25 ms 15164 KB Output is correct
167 Correct 35 ms 3624 KB Output is correct
168 Correct 45 ms 3328 KB Output is correct
169 Correct 23 ms 2896 KB Output is correct
170 Correct 91 ms 2896 KB Output is correct
171 Correct 23 ms 2584 KB Output is correct
172 Correct 22 ms 2384 KB Output is correct
173 Correct 13 ms 2384 KB Output is correct
174 Correct 41 ms 5572 KB Output is correct
175 Correct 118 ms 5848 KB Output is correct
176 Correct 129 ms 52504 KB Output is correct
177 Correct 202 ms 21036 KB Output is correct
178 Correct 292 ms 23228 KB Output is correct
179 Correct 740 ms 25380 KB Output is correct
180 Correct 737 ms 22856 KB Output is correct
181 Correct 624 ms 22192 KB Output is correct
182 Correct 897 ms 22084 KB Output is correct
183 Correct 267 ms 26984 KB Output is correct
184 Correct 305 ms 39240 KB Output is correct
185 Correct 293 ms 29584 KB Output is correct
186 Correct 368 ms 40008 KB Output is correct
187 Correct 475 ms 29172 KB Output is correct
188 Correct 235 ms 51672 KB Output is correct
189 Correct 403 ms 39240 KB Output is correct
190 Correct 298 ms 39076 KB Output is correct
191 Correct 468 ms 76272 KB Output is correct
192 Correct 329 ms 63740 KB Output is correct
193 Correct 263 ms 63840 KB Output is correct
194 Correct 461 ms 561156 KB Output is correct
195 Correct 446 ms 561160 KB Output is correct
196 Correct 537 ms 47956 KB Output is correct
197 Correct 462 ms 44628 KB Output is correct
198 Execution timed out 2069 ms 42568 KB Time limit exceeded
199 Halted 0 ms 0 KB -