Submission #832996

# Submission time Handle Problem Language Result Execution time Memory
832996 2023-08-21T18:39:40 Z WLZ Maze (JOI23_ho_t3) C++17
94 / 100
2000 ms 134848 KB
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
#include "templates/debug.h"
#else
#define debug(...) 0
#endif

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

const int INF = 0x3f3f3f3f;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int r, c, n; cin >> r >> c >> n;
  int sr, sc, gr, gc; cin >> sr >> sc >> gr >> gc;
  sr--; sc--; gr--; gc--;
  vector<string> grid(r);
  for (int i = 0; i < r; i++) cin >> grid[i];
  vector< vector<int> > dist(r, vector<int>(c, INF)); dist[sr][sc] = 0;
  priority_queue< tuple<int, int, int>, vector< tuple<int, int, int> >, greater<> > pq; pq.push({0, sr, sc});
  while (!pq.empty()) {
    int d, x, y;
    tie(d, x, y) = pq.top(); pq.pop();
    if (d > dist[x][y]) continue;
    if (d % (n + 1) < n && d % (n + 1) > 0) {
      for (int k = 0; k < 8; k++) {
        int nx = x + dxx[k], ny = y + dyy[k];
        if (nx < 0 || nx >= r || ny < 0 || ny >= c) continue;
        if (d + 1 < dist[nx][ny]) {
          dist[nx][ny] = d + 1;
          pq.push({dist[nx][ny], nx, ny});
        }
      }
    }
    if (d % (n + 1) == 0) {
      for (int k = 0; k < 4; k++) {
        int nx = x + dx[k], ny = y + dy[k];
        if (nx < 0 || nx >= r || ny < 0 || ny >= c) continue;
        if (d + 1 < dist[nx][ny]) {
          dist[nx][ny] = d + 1;
          pq.push({dist[nx][ny], nx, ny});
        }
      }
    }
    if (d % (n + 1) == n) {
      for (int k = 0; k < 4; k++) {
        int nx = x + dx[k], ny = y + dy[k];
        if (nx < 0 || nx >= r || ny < 0 || ny >= c) continue;
        if (d + 2 < dist[nx][ny]) {
          dist[nx][ny] = d + 2;
          pq.push({dist[nx][ny], nx, ny});
        }
      }
    }
    for (int k = 0; k < 4; k++) {
      int nx = x + dx[k], ny = y + dy[k];
      if (nx < 0 || nx >= r || ny < 0 || ny >= c || grid[nx][ny] == '#') continue;
      if ((d + n) / (n + 1) * (n + 1) < dist[nx][ny]) {
        dist[nx][ny] = (d + n) / (n + 1) * (n + 1);
        pq.push({dist[nx][ny], nx, ny});
      }
    }
  }
  debug(dist);
  cout << (dist[gr][gc] + n) / (n + 1) << '\n';
  return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:7:20: warning: statement has no effect [-Wunused-value]
    7 | #define debug(...) 0
      |                    ^
Main.cpp:70:3: note: in expansion of macro 'debug'
   70 |   debug(dist);
      |   ^~~~~
# 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 1 ms 340 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 0 ms 320 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 316 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 9 ms 704 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 18 ms 1548 KB Output is correct
22 Correct 14 ms 744 KB Output is correct
23 Correct 7 ms 596 KB Output is correct
24 Correct 8 ms 852 KB Output is correct
25 Correct 2 ms 968 KB Output is correct
26 Correct 16 ms 980 KB Output is correct
27 Correct 15 ms 820 KB Output is correct
28 Correct 8 ms 724 KB Output is correct
29 Correct 21 ms 1364 KB Output is correct
30 Correct 8 ms 852 KB Output is correct
31 Correct 44 ms 4412 KB Output is correct
32 Correct 34 ms 1236 KB Output is correct
33 Correct 20 ms 1220 KB Output is correct
34 Correct 23 ms 1888 KB Output is correct
35 Correct 5 ms 1888 KB Output is correct
36 Correct 40 ms 1492 KB Output is correct
37 Correct 36 ms 1364 KB Output is correct
38 Correct 21 ms 1312 KB Output is correct
39 Correct 223 ms 9360 KB Output is correct
40 Correct 35 ms 1404 KB Output is correct
41 Correct 14 ms 2272 KB Output is correct
42 Correct 39 ms 1748 KB Output is correct
43 Correct 19 ms 2380 KB Output is correct
44 Correct 158 ms 5332 KB Output is correct
45 Correct 76 ms 5744 KB Output is correct
46 Correct 537 ms 34040 KB Output is correct
47 Correct 348 ms 9552 KB Output is correct
48 Correct 200 ms 9356 KB Output is correct
49 Correct 164 ms 15088 KB Output is correct
50 Correct 47 ms 15016 KB Output is correct
51 Correct 431 ms 10180 KB Output is correct
52 Correct 365 ms 9828 KB Output is correct
53 Correct 231 ms 9576 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 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 0 ms 212 KB Output is correct
9 Correct 1 ms 316 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 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 316 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 324 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 288 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 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 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 320 KB Output is correct
13 Correct 1 ms 212 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 0 ms 212 KB Output is correct
20 Correct 0 ms 316 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 7 ms 468 KB Output is correct
26 Correct 19 ms 1492 KB Output is correct
27 Correct 18 ms 1520 KB Output is correct
28 Correct 17 ms 1588 KB Output is correct
29 Correct 9 ms 596 KB Output is correct
30 Correct 7 ms 596 KB Output is correct
31 Correct 9 ms 596 KB Output is correct
32 Correct 16 ms 980 KB Output is correct
33 Correct 14 ms 724 KB Output is correct
34 Correct 37 ms 2636 KB Output is correct
35 Correct 45 ms 4332 KB Output is correct
36 Correct 46 ms 4396 KB Output is correct
37 Correct 24 ms 1236 KB Output is correct
38 Correct 18 ms 1228 KB Output is correct
39 Correct 139 ms 9176 KB Output is correct
40 Correct 480 ms 32752 KB Output is correct
41 Correct 505 ms 34004 KB Output is correct
42 Correct 524 ms 34020 KB Output is correct
43 Correct 213 ms 9388 KB Output is correct
44 Correct 214 ms 9388 KB Output is correct
45 Correct 526 ms 34256 KB Output is correct
46 Correct 525 ms 34280 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 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 0 ms 212 KB Output is correct
9 Correct 1 ms 316 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 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 316 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 324 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 9 ms 596 KB Output is correct
34 Correct 1 ms 320 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 8 ms 496 KB Output is correct
37 Correct 2 ms 756 KB Output is correct
38 Correct 16 ms 1552 KB Output is correct
39 Correct 18 ms 1628 KB Output is correct
40 Correct 14 ms 724 KB Output is correct
41 Correct 7 ms 596 KB Output is correct
42 Correct 17 ms 1492 KB Output is correct
43 Correct 9 ms 596 KB Output is correct
44 Correct 7 ms 708 KB Output is correct
45 Correct 9 ms 852 KB Output is correct
46 Correct 2 ms 960 KB Output is correct
47 Correct 5 ms 724 KB Output is correct
48 Correct 9 ms 596 KB Output is correct
49 Correct 10 ms 596 KB Output is correct
50 Correct 8 ms 688 KB Output is correct
51 Correct 8 ms 596 KB Output is correct
52 Correct 17 ms 980 KB Output is correct
53 Correct 14 ms 824 KB Output is correct
54 Correct 8 ms 724 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 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 0 ms 212 KB Output is correct
9 Correct 1 ms 316 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 340 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 316 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 1 ms 324 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 9 ms 596 KB Output is correct
34 Correct 1 ms 320 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 8 ms 496 KB Output is correct
37 Correct 2 ms 756 KB Output is correct
38 Correct 16 ms 1552 KB Output is correct
39 Correct 18 ms 1628 KB Output is correct
40 Correct 14 ms 724 KB Output is correct
41 Correct 7 ms 596 KB Output is correct
42 Correct 17 ms 1492 KB Output is correct
43 Correct 9 ms 596 KB Output is correct
44 Correct 7 ms 708 KB Output is correct
45 Correct 9 ms 852 KB Output is correct
46 Correct 2 ms 960 KB Output is correct
47 Correct 5 ms 724 KB Output is correct
48 Correct 9 ms 596 KB Output is correct
49 Correct 10 ms 596 KB Output is correct
50 Correct 8 ms 688 KB Output is correct
51 Correct 8 ms 596 KB Output is correct
52 Correct 17 ms 980 KB Output is correct
53 Correct 14 ms 824 KB Output is correct
54 Correct 8 ms 724 KB Output is correct
55 Correct 21 ms 1236 KB Output is correct
56 Correct 8 ms 768 KB Output is correct
57 Correct 37 ms 2636 KB Output is correct
58 Correct 21 ms 1108 KB Output is correct
59 Correct 45 ms 4444 KB Output is correct
60 Correct 34 ms 1320 KB Output is correct
61 Correct 19 ms 1236 KB Output is correct
62 Correct 44 ms 4348 KB Output is correct
63 Correct 20 ms 1236 KB Output is correct
64 Correct 17 ms 1260 KB Output is correct
65 Correct 21 ms 1888 KB Output is correct
66 Correct 4 ms 1888 KB Output is correct
67 Correct 11 ms 1620 KB Output is correct
68 Correct 19 ms 1284 KB Output is correct
69 Correct 21 ms 1236 KB Output is correct
70 Correct 20 ms 1108 KB Output is correct
71 Correct 20 ms 1108 KB Output is correct
72 Correct 39 ms 1492 KB Output is correct
73 Correct 36 ms 1364 KB Output is correct
74 Correct 21 ms 1236 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 1 ms 340 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 0 ms 320 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 316 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 9 ms 704 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 18 ms 1548 KB Output is correct
22 Correct 14 ms 744 KB Output is correct
23 Correct 7 ms 596 KB Output is correct
24 Correct 8 ms 852 KB Output is correct
25 Correct 2 ms 968 KB Output is correct
26 Correct 16 ms 980 KB Output is correct
27 Correct 15 ms 820 KB Output is correct
28 Correct 8 ms 724 KB Output is correct
29 Correct 21 ms 1364 KB Output is correct
30 Correct 8 ms 852 KB Output is correct
31 Correct 44 ms 4412 KB Output is correct
32 Correct 34 ms 1236 KB Output is correct
33 Correct 20 ms 1220 KB Output is correct
34 Correct 23 ms 1888 KB Output is correct
35 Correct 5 ms 1888 KB Output is correct
36 Correct 40 ms 1492 KB Output is correct
37 Correct 36 ms 1364 KB Output is correct
38 Correct 21 ms 1312 KB Output is correct
39 Correct 223 ms 9360 KB Output is correct
40 Correct 35 ms 1404 KB Output is correct
41 Correct 14 ms 2272 KB Output is correct
42 Correct 39 ms 1748 KB Output is correct
43 Correct 19 ms 2380 KB Output is correct
44 Correct 158 ms 5332 KB Output is correct
45 Correct 76 ms 5744 KB Output is correct
46 Correct 537 ms 34040 KB Output is correct
47 Correct 348 ms 9552 KB Output is correct
48 Correct 200 ms 9356 KB Output is correct
49 Correct 164 ms 15088 KB Output is correct
50 Correct 47 ms 15016 KB Output is correct
51 Correct 431 ms 10180 KB Output is correct
52 Correct 365 ms 9828 KB Output is correct
53 Correct 231 ms 9576 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 0 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 1 ms 316 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 340 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 1 ms 212 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 0 ms 212 KB Output is correct
70 Correct 0 ms 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 1 ms 212 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 0 ms 212 KB Output is correct
76 Correct 1 ms 316 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 0 ms 212 KB Output is correct
79 Correct 0 ms 212 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 1 ms 324 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 1 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 0 ms 288 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 212 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 340 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 1 ms 340 KB Output is correct
95 Correct 1 ms 212 KB Output is correct
96 Correct 1 ms 212 KB Output is correct
97 Correct 1 ms 320 KB Output is correct
98 Correct 1 ms 212 KB Output is correct
99 Correct 1 ms 212 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 212 KB Output is correct
102 Correct 1 ms 212 KB Output is correct
103 Correct 1 ms 212 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 0 ms 316 KB Output is correct
106 Correct 1 ms 212 KB Output is correct
107 Correct 1 ms 340 KB Output is correct
108 Correct 1 ms 212 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 7 ms 468 KB Output is correct
111 Correct 19 ms 1492 KB Output is correct
112 Correct 18 ms 1520 KB Output is correct
113 Correct 17 ms 1588 KB Output is correct
114 Correct 9 ms 596 KB Output is correct
115 Correct 7 ms 596 KB Output is correct
116 Correct 9 ms 596 KB Output is correct
117 Correct 16 ms 980 KB Output is correct
118 Correct 14 ms 724 KB Output is correct
119 Correct 37 ms 2636 KB Output is correct
120 Correct 45 ms 4332 KB Output is correct
121 Correct 46 ms 4396 KB Output is correct
122 Correct 24 ms 1236 KB Output is correct
123 Correct 18 ms 1228 KB Output is correct
124 Correct 139 ms 9176 KB Output is correct
125 Correct 480 ms 32752 KB Output is correct
126 Correct 505 ms 34004 KB Output is correct
127 Correct 524 ms 34020 KB Output is correct
128 Correct 213 ms 9388 KB Output is correct
129 Correct 214 ms 9388 KB Output is correct
130 Correct 526 ms 34256 KB Output is correct
131 Correct 525 ms 34280 KB Output is correct
132 Correct 9 ms 596 KB Output is correct
133 Correct 1 ms 320 KB Output is correct
134 Correct 1 ms 340 KB Output is correct
135 Correct 8 ms 496 KB Output is correct
136 Correct 2 ms 756 KB Output is correct
137 Correct 16 ms 1552 KB Output is correct
138 Correct 18 ms 1628 KB Output is correct
139 Correct 14 ms 724 KB Output is correct
140 Correct 7 ms 596 KB Output is correct
141 Correct 17 ms 1492 KB Output is correct
142 Correct 9 ms 596 KB Output is correct
143 Correct 7 ms 708 KB Output is correct
144 Correct 9 ms 852 KB Output is correct
145 Correct 2 ms 960 KB Output is correct
146 Correct 5 ms 724 KB Output is correct
147 Correct 9 ms 596 KB Output is correct
148 Correct 10 ms 596 KB Output is correct
149 Correct 8 ms 688 KB Output is correct
150 Correct 8 ms 596 KB Output is correct
151 Correct 17 ms 980 KB Output is correct
152 Correct 14 ms 824 KB Output is correct
153 Correct 8 ms 724 KB Output is correct
154 Correct 21 ms 1236 KB Output is correct
155 Correct 8 ms 768 KB Output is correct
156 Correct 37 ms 2636 KB Output is correct
157 Correct 21 ms 1108 KB Output is correct
158 Correct 45 ms 4444 KB Output is correct
159 Correct 34 ms 1320 KB Output is correct
160 Correct 19 ms 1236 KB Output is correct
161 Correct 44 ms 4348 KB Output is correct
162 Correct 20 ms 1236 KB Output is correct
163 Correct 17 ms 1260 KB Output is correct
164 Correct 21 ms 1888 KB Output is correct
165 Correct 4 ms 1888 KB Output is correct
166 Correct 11 ms 1620 KB Output is correct
167 Correct 19 ms 1284 KB Output is correct
168 Correct 21 ms 1236 KB Output is correct
169 Correct 20 ms 1108 KB Output is correct
170 Correct 20 ms 1108 KB Output is correct
171 Correct 39 ms 1492 KB Output is correct
172 Correct 36 ms 1364 KB Output is correct
173 Correct 21 ms 1236 KB Output is correct
174 Correct 38 ms 1620 KB Output is correct
175 Correct 43 ms 2388 KB Output is correct
176 Correct 75 ms 5876 KB Output is correct
177 Correct 132 ms 6600 KB Output is correct
178 Correct 207 ms 8408 KB Output is correct
179 Correct 184 ms 9548 KB Output is correct
180 Correct 203 ms 9524 KB Output is correct
181 Correct 215 ms 9536 KB Output is correct
182 Correct 213 ms 9500 KB Output is correct
183 Correct 417 ms 12668 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 1 ms 340 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 0 ms 320 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 316 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 9 ms 704 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 18 ms 1548 KB Output is correct
22 Correct 14 ms 744 KB Output is correct
23 Correct 7 ms 596 KB Output is correct
24 Correct 8 ms 852 KB Output is correct
25 Correct 2 ms 968 KB Output is correct
26 Correct 16 ms 980 KB Output is correct
27 Correct 15 ms 820 KB Output is correct
28 Correct 8 ms 724 KB Output is correct
29 Correct 21 ms 1364 KB Output is correct
30 Correct 8 ms 852 KB Output is correct
31 Correct 44 ms 4412 KB Output is correct
32 Correct 34 ms 1236 KB Output is correct
33 Correct 20 ms 1220 KB Output is correct
34 Correct 23 ms 1888 KB Output is correct
35 Correct 5 ms 1888 KB Output is correct
36 Correct 40 ms 1492 KB Output is correct
37 Correct 36 ms 1364 KB Output is correct
38 Correct 21 ms 1312 KB Output is correct
39 Correct 223 ms 9360 KB Output is correct
40 Correct 35 ms 1404 KB Output is correct
41 Correct 14 ms 2272 KB Output is correct
42 Correct 39 ms 1748 KB Output is correct
43 Correct 19 ms 2380 KB Output is correct
44 Correct 158 ms 5332 KB Output is correct
45 Correct 76 ms 5744 KB Output is correct
46 Correct 537 ms 34040 KB Output is correct
47 Correct 348 ms 9552 KB Output is correct
48 Correct 200 ms 9356 KB Output is correct
49 Correct 164 ms 15088 KB Output is correct
50 Correct 47 ms 15016 KB Output is correct
51 Correct 431 ms 10180 KB Output is correct
52 Correct 365 ms 9828 KB Output is correct
53 Correct 231 ms 9576 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 0 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 1 ms 316 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 340 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 1 ms 212 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 0 ms 212 KB Output is correct
70 Correct 0 ms 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 1 ms 212 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 0 ms 212 KB Output is correct
76 Correct 1 ms 316 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 0 ms 212 KB Output is correct
79 Correct 0 ms 212 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 1 ms 324 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 1 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 0 ms 288 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 212 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 340 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 1 ms 340 KB Output is correct
95 Correct 1 ms 212 KB Output is correct
96 Correct 1 ms 212 KB Output is correct
97 Correct 1 ms 320 KB Output is correct
98 Correct 1 ms 212 KB Output is correct
99 Correct 1 ms 212 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 212 KB Output is correct
102 Correct 1 ms 212 KB Output is correct
103 Correct 1 ms 212 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 0 ms 316 KB Output is correct
106 Correct 1 ms 212 KB Output is correct
107 Correct 1 ms 340 KB Output is correct
108 Correct 1 ms 212 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 7 ms 468 KB Output is correct
111 Correct 19 ms 1492 KB Output is correct
112 Correct 18 ms 1520 KB Output is correct
113 Correct 17 ms 1588 KB Output is correct
114 Correct 9 ms 596 KB Output is correct
115 Correct 7 ms 596 KB Output is correct
116 Correct 9 ms 596 KB Output is correct
117 Correct 16 ms 980 KB Output is correct
118 Correct 14 ms 724 KB Output is correct
119 Correct 37 ms 2636 KB Output is correct
120 Correct 45 ms 4332 KB Output is correct
121 Correct 46 ms 4396 KB Output is correct
122 Correct 24 ms 1236 KB Output is correct
123 Correct 18 ms 1228 KB Output is correct
124 Correct 139 ms 9176 KB Output is correct
125 Correct 480 ms 32752 KB Output is correct
126 Correct 505 ms 34004 KB Output is correct
127 Correct 524 ms 34020 KB Output is correct
128 Correct 213 ms 9388 KB Output is correct
129 Correct 214 ms 9388 KB Output is correct
130 Correct 526 ms 34256 KB Output is correct
131 Correct 525 ms 34280 KB Output is correct
132 Correct 9 ms 596 KB Output is correct
133 Correct 1 ms 320 KB Output is correct
134 Correct 1 ms 340 KB Output is correct
135 Correct 8 ms 496 KB Output is correct
136 Correct 2 ms 756 KB Output is correct
137 Correct 16 ms 1552 KB Output is correct
138 Correct 18 ms 1628 KB Output is correct
139 Correct 14 ms 724 KB Output is correct
140 Correct 7 ms 596 KB Output is correct
141 Correct 17 ms 1492 KB Output is correct
142 Correct 9 ms 596 KB Output is correct
143 Correct 7 ms 708 KB Output is correct
144 Correct 9 ms 852 KB Output is correct
145 Correct 2 ms 960 KB Output is correct
146 Correct 5 ms 724 KB Output is correct
147 Correct 9 ms 596 KB Output is correct
148 Correct 10 ms 596 KB Output is correct
149 Correct 8 ms 688 KB Output is correct
150 Correct 8 ms 596 KB Output is correct
151 Correct 17 ms 980 KB Output is correct
152 Correct 14 ms 824 KB Output is correct
153 Correct 8 ms 724 KB Output is correct
154 Correct 21 ms 1236 KB Output is correct
155 Correct 8 ms 768 KB Output is correct
156 Correct 37 ms 2636 KB Output is correct
157 Correct 21 ms 1108 KB Output is correct
158 Correct 45 ms 4444 KB Output is correct
159 Correct 34 ms 1320 KB Output is correct
160 Correct 19 ms 1236 KB Output is correct
161 Correct 44 ms 4348 KB Output is correct
162 Correct 20 ms 1236 KB Output is correct
163 Correct 17 ms 1260 KB Output is correct
164 Correct 21 ms 1888 KB Output is correct
165 Correct 4 ms 1888 KB Output is correct
166 Correct 11 ms 1620 KB Output is correct
167 Correct 19 ms 1284 KB Output is correct
168 Correct 21 ms 1236 KB Output is correct
169 Correct 20 ms 1108 KB Output is correct
170 Correct 20 ms 1108 KB Output is correct
171 Correct 39 ms 1492 KB Output is correct
172 Correct 36 ms 1364 KB Output is correct
173 Correct 21 ms 1236 KB Output is correct
174 Correct 38 ms 1620 KB Output is correct
175 Correct 43 ms 2388 KB Output is correct
176 Correct 75 ms 5876 KB Output is correct
177 Correct 132 ms 6600 KB Output is correct
178 Correct 207 ms 8408 KB Output is correct
179 Correct 184 ms 9548 KB Output is correct
180 Correct 203 ms 9524 KB Output is correct
181 Correct 215 ms 9536 KB Output is correct
182 Correct 213 ms 9500 KB Output is correct
183 Correct 417 ms 12668 KB Output is correct
184 Correct 465 ms 18348 KB Output is correct
185 Correct 204 ms 10520 KB Output is correct
186 Correct 635 ms 35556 KB Output is correct
187 Correct 282 ms 13208 KB Output is correct
188 Correct 1098 ms 67708 KB Output is correct
189 Correct 747 ms 18588 KB Output is correct
190 Correct 427 ms 18360 KB Output is correct
191 Correct 1087 ms 67636 KB Output is correct
192 Correct 486 ms 18416 KB Output is correct
193 Correct 387 ms 18340 KB Output is correct
194 Correct 341 ms 29800 KB Output is correct
195 Correct 80 ms 29804 KB Output is correct
196 Correct 385 ms 18608 KB Output is correct
197 Correct 375 ms 18652 KB Output is correct
198 Correct 436 ms 18576 KB Output is correct
199 Correct 396 ms 18644 KB Output is correct
200 Correct 863 ms 19900 KB Output is correct
201 Correct 762 ms 19152 KB Output is correct
202 Correct 464 ms 18580 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 1 ms 340 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 0 ms 320 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 316 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 9 ms 704 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 18 ms 1548 KB Output is correct
22 Correct 14 ms 744 KB Output is correct
23 Correct 7 ms 596 KB Output is correct
24 Correct 8 ms 852 KB Output is correct
25 Correct 2 ms 968 KB Output is correct
26 Correct 16 ms 980 KB Output is correct
27 Correct 15 ms 820 KB Output is correct
28 Correct 8 ms 724 KB Output is correct
29 Correct 21 ms 1364 KB Output is correct
30 Correct 8 ms 852 KB Output is correct
31 Correct 44 ms 4412 KB Output is correct
32 Correct 34 ms 1236 KB Output is correct
33 Correct 20 ms 1220 KB Output is correct
34 Correct 23 ms 1888 KB Output is correct
35 Correct 5 ms 1888 KB Output is correct
36 Correct 40 ms 1492 KB Output is correct
37 Correct 36 ms 1364 KB Output is correct
38 Correct 21 ms 1312 KB Output is correct
39 Correct 223 ms 9360 KB Output is correct
40 Correct 35 ms 1404 KB Output is correct
41 Correct 14 ms 2272 KB Output is correct
42 Correct 39 ms 1748 KB Output is correct
43 Correct 19 ms 2380 KB Output is correct
44 Correct 158 ms 5332 KB Output is correct
45 Correct 76 ms 5744 KB Output is correct
46 Correct 537 ms 34040 KB Output is correct
47 Correct 348 ms 9552 KB Output is correct
48 Correct 200 ms 9356 KB Output is correct
49 Correct 164 ms 15088 KB Output is correct
50 Correct 47 ms 15016 KB Output is correct
51 Correct 431 ms 10180 KB Output is correct
52 Correct 365 ms 9828 KB Output is correct
53 Correct 231 ms 9576 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 0 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 1 ms 316 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 340 KB Output is correct
66 Correct 1 ms 212 KB Output is correct
67 Correct 1 ms 212 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 0 ms 212 KB Output is correct
70 Correct 0 ms 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 1 ms 340 KB Output is correct
73 Correct 1 ms 212 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 0 ms 212 KB Output is correct
76 Correct 1 ms 316 KB Output is correct
77 Correct 1 ms 212 KB Output is correct
78 Correct 0 ms 212 KB Output is correct
79 Correct 0 ms 212 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 1 ms 324 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 1 ms 340 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 1 ms 340 KB Output is correct
86 Correct 0 ms 288 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 212 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 340 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 1 ms 340 KB Output is correct
95 Correct 1 ms 212 KB Output is correct
96 Correct 1 ms 212 KB Output is correct
97 Correct 1 ms 320 KB Output is correct
98 Correct 1 ms 212 KB Output is correct
99 Correct 1 ms 212 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 212 KB Output is correct
102 Correct 1 ms 212 KB Output is correct
103 Correct 1 ms 212 KB Output is correct
104 Correct 0 ms 212 KB Output is correct
105 Correct 0 ms 316 KB Output is correct
106 Correct 1 ms 212 KB Output is correct
107 Correct 1 ms 340 KB Output is correct
108 Correct 1 ms 212 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 7 ms 468 KB Output is correct
111 Correct 19 ms 1492 KB Output is correct
112 Correct 18 ms 1520 KB Output is correct
113 Correct 17 ms 1588 KB Output is correct
114 Correct 9 ms 596 KB Output is correct
115 Correct 7 ms 596 KB Output is correct
116 Correct 9 ms 596 KB Output is correct
117 Correct 16 ms 980 KB Output is correct
118 Correct 14 ms 724 KB Output is correct
119 Correct 37 ms 2636 KB Output is correct
120 Correct 45 ms 4332 KB Output is correct
121 Correct 46 ms 4396 KB Output is correct
122 Correct 24 ms 1236 KB Output is correct
123 Correct 18 ms 1228 KB Output is correct
124 Correct 139 ms 9176 KB Output is correct
125 Correct 480 ms 32752 KB Output is correct
126 Correct 505 ms 34004 KB Output is correct
127 Correct 524 ms 34020 KB Output is correct
128 Correct 213 ms 9388 KB Output is correct
129 Correct 214 ms 9388 KB Output is correct
130 Correct 526 ms 34256 KB Output is correct
131 Correct 525 ms 34280 KB Output is correct
132 Correct 9 ms 596 KB Output is correct
133 Correct 1 ms 320 KB Output is correct
134 Correct 1 ms 340 KB Output is correct
135 Correct 8 ms 496 KB Output is correct
136 Correct 2 ms 756 KB Output is correct
137 Correct 16 ms 1552 KB Output is correct
138 Correct 18 ms 1628 KB Output is correct
139 Correct 14 ms 724 KB Output is correct
140 Correct 7 ms 596 KB Output is correct
141 Correct 17 ms 1492 KB Output is correct
142 Correct 9 ms 596 KB Output is correct
143 Correct 7 ms 708 KB Output is correct
144 Correct 9 ms 852 KB Output is correct
145 Correct 2 ms 960 KB Output is correct
146 Correct 5 ms 724 KB Output is correct
147 Correct 9 ms 596 KB Output is correct
148 Correct 10 ms 596 KB Output is correct
149 Correct 8 ms 688 KB Output is correct
150 Correct 8 ms 596 KB Output is correct
151 Correct 17 ms 980 KB Output is correct
152 Correct 14 ms 824 KB Output is correct
153 Correct 8 ms 724 KB Output is correct
154 Correct 21 ms 1236 KB Output is correct
155 Correct 8 ms 768 KB Output is correct
156 Correct 37 ms 2636 KB Output is correct
157 Correct 21 ms 1108 KB Output is correct
158 Correct 45 ms 4444 KB Output is correct
159 Correct 34 ms 1320 KB Output is correct
160 Correct 19 ms 1236 KB Output is correct
161 Correct 44 ms 4348 KB Output is correct
162 Correct 20 ms 1236 KB Output is correct
163 Correct 17 ms 1260 KB Output is correct
164 Correct 21 ms 1888 KB Output is correct
165 Correct 4 ms 1888 KB Output is correct
166 Correct 11 ms 1620 KB Output is correct
167 Correct 19 ms 1284 KB Output is correct
168 Correct 21 ms 1236 KB Output is correct
169 Correct 20 ms 1108 KB Output is correct
170 Correct 20 ms 1108 KB Output is correct
171 Correct 39 ms 1492 KB Output is correct
172 Correct 36 ms 1364 KB Output is correct
173 Correct 21 ms 1236 KB Output is correct
174 Correct 38 ms 1620 KB Output is correct
175 Correct 43 ms 2388 KB Output is correct
176 Correct 75 ms 5876 KB Output is correct
177 Correct 132 ms 6600 KB Output is correct
178 Correct 207 ms 8408 KB Output is correct
179 Correct 184 ms 9548 KB Output is correct
180 Correct 203 ms 9524 KB Output is correct
181 Correct 215 ms 9536 KB Output is correct
182 Correct 213 ms 9500 KB Output is correct
183 Correct 417 ms 12668 KB Output is correct
184 Correct 465 ms 18348 KB Output is correct
185 Correct 204 ms 10520 KB Output is correct
186 Correct 635 ms 35556 KB Output is correct
187 Correct 282 ms 13208 KB Output is correct
188 Correct 1098 ms 67708 KB Output is correct
189 Correct 747 ms 18588 KB Output is correct
190 Correct 427 ms 18360 KB Output is correct
191 Correct 1087 ms 67636 KB Output is correct
192 Correct 486 ms 18416 KB Output is correct
193 Correct 387 ms 18340 KB Output is correct
194 Correct 341 ms 29800 KB Output is correct
195 Correct 80 ms 29804 KB Output is correct
196 Correct 385 ms 18608 KB Output is correct
197 Correct 375 ms 18652 KB Output is correct
198 Correct 436 ms 18576 KB Output is correct
199 Correct 396 ms 18644 KB Output is correct
200 Correct 863 ms 19900 KB Output is correct
201 Correct 762 ms 19152 KB Output is correct
202 Correct 464 ms 18580 KB Output is correct
203 Correct 949 ms 36420 KB Output is correct
204 Correct 390 ms 19232 KB Output is correct
205 Correct 768 ms 22792 KB Output is correct
206 Correct 852 ms 36448 KB Output is correct
207 Execution timed out 2051 ms 134848 KB Time limit exceeded
208 Halted 0 ms 0 KB -