Submission #833002

# Submission time Handle Problem Language Result Execution time Memory
833002 2023-08-21T18:53:40 Z WLZ Maze (JOI23_ho_t3) C++17
94 / 100
2000 ms 129036 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, 1, 1, -1, -1};
const vector<int> dy = {0, 0, 1, -1, -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});
  queue< tuple<int, int> > q;
  while (!q.empty() || !pq.empty()) {
    int d, x, y;
    if (q.empty()) tie(d, x, y) = pq.top(), pq.pop();
    else {
      tie(x, y) = q.front(); q.pop();
      d = dist[x][y];
    }
    if (d > dist[x][y]) continue;
    for (int k = 0; k < 8; k++) {
      int nx = x + dx[k], ny = y + dy[k];
      if (nx < 0 || nx >= r || ny < 0 || ny >= c) continue;
      if (0 < d % (n + 1) && d % (n + 1) < n && d + 1 < dist[nx][ny]) {
        dist[nx][ny] = d + 1;
        pq.push({dist[nx][ny], nx, ny});
      }
      if (k >= 4) continue;
      if (d % (n + 1) == 0 && d + 1 < dist[nx][ny]) {
        dist[nx][ny] = d + 1;
        pq.push({dist[nx][ny], nx, ny});
      }
      if (d % (n + 1) == n && d + 2 < dist[nx][ny]) {
        dist[nx][ny] = d + 2;
        pq.push({dist[nx][ny], nx, ny});
      }
      if (grid[nx][ny] == '.' && (d + n) / (n + 1) * (n + 1) < dist[nx][ny]) {
        dist[nx][ny] = (d + n) / (n + 1) * (n + 1);
        if (d % (n + 1) == 0) q.push({nx, ny});
        else 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:58:3: note: in expansion of macro 'debug'
   58 |   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 1 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 0 ms 212 KB Output is correct
8 Correct 0 ms 212 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 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 12 ms 596 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 13 ms 1492 KB Output is correct
22 Correct 12 ms 676 KB Output is correct
23 Correct 8 ms 596 KB Output is correct
24 Correct 6 ms 852 KB Output is correct
25 Correct 2 ms 852 KB Output is correct
26 Correct 13 ms 852 KB Output is correct
27 Correct 13 ms 760 KB Output is correct
28 Correct 9 ms 596 KB Output is correct
29 Correct 23 ms 1104 KB Output is correct
30 Correct 7 ms 724 KB Output is correct
31 Correct 33 ms 4292 KB Output is correct
32 Correct 39 ms 1144 KB Output is correct
33 Correct 20 ms 1108 KB Output is correct
34 Correct 16 ms 1760 KB Output is correct
35 Correct 5 ms 1760 KB Output is correct
36 Correct 36 ms 1364 KB Output is correct
37 Correct 36 ms 1236 KB Output is correct
38 Correct 25 ms 1184 KB Output is correct
39 Correct 253 ms 7912 KB Output is correct
40 Correct 37 ms 1236 KB Output is correct
41 Correct 13 ms 2016 KB Output is correct
42 Correct 36 ms 1364 KB Output is correct
43 Correct 25 ms 2132 KB Output is correct
44 Correct 122 ms 4640 KB Output is correct
45 Correct 96 ms 4976 KB Output is correct
46 Correct 415 ms 32576 KB Output is correct
47 Correct 328 ms 8080 KB Output is correct
48 Correct 234 ms 7864 KB Output is correct
49 Correct 142 ms 13560 KB Output is correct
50 Correct 64 ms 13560 KB Output is correct
51 Correct 365 ms 8656 KB Output is correct
52 Correct 338 ms 8344 KB Output is correct
53 Correct 253 ms 8100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 232 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 0 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 216 KB Output is correct
18 Correct 0 ms 216 KB Output is correct
19 Correct 1 ms 220 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 232 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 216 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 216 KB Output is correct
32 Correct 1 ms 216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 216 KB Output is correct
2 Correct 0 ms 216 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 1 ms 344 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 340 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 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 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 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 6 ms 468 KB Output is correct
26 Correct 12 ms 1412 KB Output is correct
27 Correct 14 ms 1492 KB Output is correct
28 Correct 13 ms 1496 KB Output is correct
29 Correct 9 ms 596 KB Output is correct
30 Correct 6 ms 596 KB Output is correct
31 Correct 8 ms 596 KB Output is correct
32 Correct 13 ms 852 KB Output is correct
33 Correct 12 ms 724 KB Output is correct
34 Correct 27 ms 2512 KB Output is correct
35 Correct 35 ms 4200 KB Output is correct
36 Correct 34 ms 4300 KB Output is correct
37 Correct 20 ms 1104 KB Output is correct
38 Correct 17 ms 1108 KB Output is correct
39 Correct 107 ms 8824 KB Output is correct
40 Correct 344 ms 31536 KB Output is correct
41 Correct 400 ms 32692 KB Output is correct
42 Correct 394 ms 32512 KB Output is correct
43 Correct 208 ms 7892 KB Output is correct
44 Correct 187 ms 7884 KB Output is correct
45 Correct 405 ms 32732 KB Output is correct
46 Correct 415 ms 32768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 232 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 0 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 216 KB Output is correct
18 Correct 0 ms 216 KB Output is correct
19 Correct 1 ms 220 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 232 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 216 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 216 KB Output is correct
32 Correct 1 ms 216 KB Output is correct
33 Correct 9 ms 596 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 6 ms 468 KB Output is correct
37 Correct 2 ms 724 KB Output is correct
38 Correct 11 ms 1492 KB Output is correct
39 Correct 13 ms 1492 KB Output is correct
40 Correct 12 ms 596 KB Output is correct
41 Correct 8 ms 596 KB Output is correct
42 Correct 13 ms 1508 KB Output is correct
43 Correct 8 ms 652 KB Output is correct
44 Correct 6 ms 596 KB Output is correct
45 Correct 5 ms 852 KB Output is correct
46 Correct 2 ms 852 KB Output is correct
47 Correct 5 ms 724 KB Output is correct
48 Correct 8 ms 596 KB Output is correct
49 Correct 9 ms 596 KB Output is correct
50 Correct 7 ms 596 KB Output is correct
51 Correct 7 ms 596 KB Output is correct
52 Correct 13 ms 852 KB Output is correct
53 Correct 12 ms 764 KB Output is correct
54 Correct 9 ms 680 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 232 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 0 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 216 KB Output is correct
18 Correct 0 ms 216 KB Output is correct
19 Correct 1 ms 220 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 0 ms 232 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 216 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 216 KB Output is correct
32 Correct 1 ms 216 KB Output is correct
33 Correct 9 ms 596 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 340 KB Output is correct
36 Correct 6 ms 468 KB Output is correct
37 Correct 2 ms 724 KB Output is correct
38 Correct 11 ms 1492 KB Output is correct
39 Correct 13 ms 1492 KB Output is correct
40 Correct 12 ms 596 KB Output is correct
41 Correct 8 ms 596 KB Output is correct
42 Correct 13 ms 1508 KB Output is correct
43 Correct 8 ms 652 KB Output is correct
44 Correct 6 ms 596 KB Output is correct
45 Correct 5 ms 852 KB Output is correct
46 Correct 2 ms 852 KB Output is correct
47 Correct 5 ms 724 KB Output is correct
48 Correct 8 ms 596 KB Output is correct
49 Correct 9 ms 596 KB Output is correct
50 Correct 7 ms 596 KB Output is correct
51 Correct 7 ms 596 KB Output is correct
52 Correct 13 ms 852 KB Output is correct
53 Correct 12 ms 764 KB Output is correct
54 Correct 9 ms 680 KB Output is correct
55 Correct 22 ms 1108 KB Output is correct
56 Correct 7 ms 724 KB Output is correct
57 Correct 27 ms 2512 KB Output is correct
58 Correct 20 ms 980 KB Output is correct
59 Correct 33 ms 4300 KB Output is correct
60 Correct 32 ms 1236 KB Output is correct
61 Correct 20 ms 1108 KB Output is correct
62 Correct 33 ms 4220 KB Output is correct
63 Correct 20 ms 1108 KB Output is correct
64 Correct 17 ms 1112 KB Output is correct
65 Correct 14 ms 1760 KB Output is correct
66 Correct 5 ms 1760 KB Output is correct
67 Correct 12 ms 1364 KB Output is correct
68 Correct 19 ms 1108 KB Output is correct
69 Correct 19 ms 980 KB Output is correct
70 Correct 19 ms 980 KB Output is correct
71 Correct 19 ms 1088 KB Output is correct
72 Correct 32 ms 1396 KB Output is correct
73 Correct 31 ms 1236 KB Output is correct
74 Correct 23 ms 1168 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 1 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 0 ms 212 KB Output is correct
8 Correct 0 ms 212 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 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 12 ms 596 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 13 ms 1492 KB Output is correct
22 Correct 12 ms 676 KB Output is correct
23 Correct 8 ms 596 KB Output is correct
24 Correct 6 ms 852 KB Output is correct
25 Correct 2 ms 852 KB Output is correct
26 Correct 13 ms 852 KB Output is correct
27 Correct 13 ms 760 KB Output is correct
28 Correct 9 ms 596 KB Output is correct
29 Correct 23 ms 1104 KB Output is correct
30 Correct 7 ms 724 KB Output is correct
31 Correct 33 ms 4292 KB Output is correct
32 Correct 39 ms 1144 KB Output is correct
33 Correct 20 ms 1108 KB Output is correct
34 Correct 16 ms 1760 KB Output is correct
35 Correct 5 ms 1760 KB Output is correct
36 Correct 36 ms 1364 KB Output is correct
37 Correct 36 ms 1236 KB Output is correct
38 Correct 25 ms 1184 KB Output is correct
39 Correct 253 ms 7912 KB Output is correct
40 Correct 37 ms 1236 KB Output is correct
41 Correct 13 ms 2016 KB Output is correct
42 Correct 36 ms 1364 KB Output is correct
43 Correct 25 ms 2132 KB Output is correct
44 Correct 122 ms 4640 KB Output is correct
45 Correct 96 ms 4976 KB Output is correct
46 Correct 415 ms 32576 KB Output is correct
47 Correct 328 ms 8080 KB Output is correct
48 Correct 234 ms 7864 KB Output is correct
49 Correct 142 ms 13560 KB Output is correct
50 Correct 64 ms 13560 KB Output is correct
51 Correct 365 ms 8656 KB Output is correct
52 Correct 338 ms 8344 KB Output is correct
53 Correct 253 ms 8100 KB Output is correct
54 Correct 0 ms 212 KB Output is correct
55 Correct 1 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 232 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 0 ms 340 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 0 ms 212 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 0 ms 212 KB Output is correct
69 Correct 0 ms 212 KB Output is correct
70 Correct 1 ms 216 KB Output is correct
71 Correct 0 ms 216 KB Output is correct
72 Correct 1 ms 220 KB Output is correct
73 Correct 0 ms 212 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 1 ms 212 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 0 ms 212 KB Output is correct
78 Correct 1 ms 212 KB Output is correct
79 Correct 0 ms 232 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 0 ms 216 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 216 KB Output is correct
85 Correct 1 ms 216 KB Output is correct
86 Correct 0 ms 216 KB Output is correct
87 Correct 0 ms 216 KB Output is correct
88 Correct 0 ms 212 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 1 ms 212 KB Output is correct
91 Correct 0 ms 212 KB Output is correct
92 Correct 1 ms 344 KB Output is correct
93 Correct 0 ms 212 KB Output is correct
94 Correct 1 ms 340 KB Output is correct
95 Correct 0 ms 212 KB Output is correct
96 Correct 0 ms 212 KB Output is correct
97 Correct 0 ms 212 KB Output is correct
98 Correct 0 ms 212 KB Output is correct
99 Correct 0 ms 212 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 0 ms 212 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 0 ms 212 KB Output is correct
106 Correct 0 ms 212 KB Output is correct
107 Correct 1 ms 212 KB Output is correct
108 Correct 0 ms 212 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 6 ms 468 KB Output is correct
111 Correct 12 ms 1412 KB Output is correct
112 Correct 14 ms 1492 KB Output is correct
113 Correct 13 ms 1496 KB Output is correct
114 Correct 9 ms 596 KB Output is correct
115 Correct 6 ms 596 KB Output is correct
116 Correct 8 ms 596 KB Output is correct
117 Correct 13 ms 852 KB Output is correct
118 Correct 12 ms 724 KB Output is correct
119 Correct 27 ms 2512 KB Output is correct
120 Correct 35 ms 4200 KB Output is correct
121 Correct 34 ms 4300 KB Output is correct
122 Correct 20 ms 1104 KB Output is correct
123 Correct 17 ms 1108 KB Output is correct
124 Correct 107 ms 8824 KB Output is correct
125 Correct 344 ms 31536 KB Output is correct
126 Correct 400 ms 32692 KB Output is correct
127 Correct 394 ms 32512 KB Output is correct
128 Correct 208 ms 7892 KB Output is correct
129 Correct 187 ms 7884 KB Output is correct
130 Correct 405 ms 32732 KB Output is correct
131 Correct 415 ms 32768 KB Output is correct
132 Correct 9 ms 596 KB Output is correct
133 Correct 1 ms 340 KB Output is correct
134 Correct 1 ms 340 KB Output is correct
135 Correct 6 ms 468 KB Output is correct
136 Correct 2 ms 724 KB Output is correct
137 Correct 11 ms 1492 KB Output is correct
138 Correct 13 ms 1492 KB Output is correct
139 Correct 12 ms 596 KB Output is correct
140 Correct 8 ms 596 KB Output is correct
141 Correct 13 ms 1508 KB Output is correct
142 Correct 8 ms 652 KB Output is correct
143 Correct 6 ms 596 KB Output is correct
144 Correct 5 ms 852 KB Output is correct
145 Correct 2 ms 852 KB Output is correct
146 Correct 5 ms 724 KB Output is correct
147 Correct 8 ms 596 KB Output is correct
148 Correct 9 ms 596 KB Output is correct
149 Correct 7 ms 596 KB Output is correct
150 Correct 7 ms 596 KB Output is correct
151 Correct 13 ms 852 KB Output is correct
152 Correct 12 ms 764 KB Output is correct
153 Correct 9 ms 680 KB Output is correct
154 Correct 22 ms 1108 KB Output is correct
155 Correct 7 ms 724 KB Output is correct
156 Correct 27 ms 2512 KB Output is correct
157 Correct 20 ms 980 KB Output is correct
158 Correct 33 ms 4300 KB Output is correct
159 Correct 32 ms 1236 KB Output is correct
160 Correct 20 ms 1108 KB Output is correct
161 Correct 33 ms 4220 KB Output is correct
162 Correct 20 ms 1108 KB Output is correct
163 Correct 17 ms 1112 KB Output is correct
164 Correct 14 ms 1760 KB Output is correct
165 Correct 5 ms 1760 KB Output is correct
166 Correct 12 ms 1364 KB Output is correct
167 Correct 19 ms 1108 KB Output is correct
168 Correct 19 ms 980 KB Output is correct
169 Correct 19 ms 980 KB Output is correct
170 Correct 19 ms 1088 KB Output is correct
171 Correct 32 ms 1396 KB Output is correct
172 Correct 31 ms 1236 KB Output is correct
173 Correct 23 ms 1168 KB Output is correct
174 Correct 32 ms 1364 KB Output is correct
175 Correct 40 ms 2004 KB Output is correct
176 Correct 79 ms 5128 KB Output is correct
177 Correct 125 ms 5588 KB Output is correct
178 Correct 198 ms 7124 KB Output is correct
179 Correct 180 ms 8068 KB Output is correct
180 Correct 195 ms 8020 KB Output is correct
181 Correct 206 ms 8068 KB Output is correct
182 Correct 214 ms 8064 KB Output is correct
183 Correct 311 ms 11140 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 1 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 0 ms 212 KB Output is correct
8 Correct 0 ms 212 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 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 12 ms 596 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 13 ms 1492 KB Output is correct
22 Correct 12 ms 676 KB Output is correct
23 Correct 8 ms 596 KB Output is correct
24 Correct 6 ms 852 KB Output is correct
25 Correct 2 ms 852 KB Output is correct
26 Correct 13 ms 852 KB Output is correct
27 Correct 13 ms 760 KB Output is correct
28 Correct 9 ms 596 KB Output is correct
29 Correct 23 ms 1104 KB Output is correct
30 Correct 7 ms 724 KB Output is correct
31 Correct 33 ms 4292 KB Output is correct
32 Correct 39 ms 1144 KB Output is correct
33 Correct 20 ms 1108 KB Output is correct
34 Correct 16 ms 1760 KB Output is correct
35 Correct 5 ms 1760 KB Output is correct
36 Correct 36 ms 1364 KB Output is correct
37 Correct 36 ms 1236 KB Output is correct
38 Correct 25 ms 1184 KB Output is correct
39 Correct 253 ms 7912 KB Output is correct
40 Correct 37 ms 1236 KB Output is correct
41 Correct 13 ms 2016 KB Output is correct
42 Correct 36 ms 1364 KB Output is correct
43 Correct 25 ms 2132 KB Output is correct
44 Correct 122 ms 4640 KB Output is correct
45 Correct 96 ms 4976 KB Output is correct
46 Correct 415 ms 32576 KB Output is correct
47 Correct 328 ms 8080 KB Output is correct
48 Correct 234 ms 7864 KB Output is correct
49 Correct 142 ms 13560 KB Output is correct
50 Correct 64 ms 13560 KB Output is correct
51 Correct 365 ms 8656 KB Output is correct
52 Correct 338 ms 8344 KB Output is correct
53 Correct 253 ms 8100 KB Output is correct
54 Correct 0 ms 212 KB Output is correct
55 Correct 1 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 232 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 0 ms 340 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 0 ms 212 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 0 ms 212 KB Output is correct
69 Correct 0 ms 212 KB Output is correct
70 Correct 1 ms 216 KB Output is correct
71 Correct 0 ms 216 KB Output is correct
72 Correct 1 ms 220 KB Output is correct
73 Correct 0 ms 212 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 1 ms 212 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 0 ms 212 KB Output is correct
78 Correct 1 ms 212 KB Output is correct
79 Correct 0 ms 232 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 0 ms 216 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 216 KB Output is correct
85 Correct 1 ms 216 KB Output is correct
86 Correct 0 ms 216 KB Output is correct
87 Correct 0 ms 216 KB Output is correct
88 Correct 0 ms 212 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 1 ms 212 KB Output is correct
91 Correct 0 ms 212 KB Output is correct
92 Correct 1 ms 344 KB Output is correct
93 Correct 0 ms 212 KB Output is correct
94 Correct 1 ms 340 KB Output is correct
95 Correct 0 ms 212 KB Output is correct
96 Correct 0 ms 212 KB Output is correct
97 Correct 0 ms 212 KB Output is correct
98 Correct 0 ms 212 KB Output is correct
99 Correct 0 ms 212 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 0 ms 212 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 0 ms 212 KB Output is correct
106 Correct 0 ms 212 KB Output is correct
107 Correct 1 ms 212 KB Output is correct
108 Correct 0 ms 212 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 6 ms 468 KB Output is correct
111 Correct 12 ms 1412 KB Output is correct
112 Correct 14 ms 1492 KB Output is correct
113 Correct 13 ms 1496 KB Output is correct
114 Correct 9 ms 596 KB Output is correct
115 Correct 6 ms 596 KB Output is correct
116 Correct 8 ms 596 KB Output is correct
117 Correct 13 ms 852 KB Output is correct
118 Correct 12 ms 724 KB Output is correct
119 Correct 27 ms 2512 KB Output is correct
120 Correct 35 ms 4200 KB Output is correct
121 Correct 34 ms 4300 KB Output is correct
122 Correct 20 ms 1104 KB Output is correct
123 Correct 17 ms 1108 KB Output is correct
124 Correct 107 ms 8824 KB Output is correct
125 Correct 344 ms 31536 KB Output is correct
126 Correct 400 ms 32692 KB Output is correct
127 Correct 394 ms 32512 KB Output is correct
128 Correct 208 ms 7892 KB Output is correct
129 Correct 187 ms 7884 KB Output is correct
130 Correct 405 ms 32732 KB Output is correct
131 Correct 415 ms 32768 KB Output is correct
132 Correct 9 ms 596 KB Output is correct
133 Correct 1 ms 340 KB Output is correct
134 Correct 1 ms 340 KB Output is correct
135 Correct 6 ms 468 KB Output is correct
136 Correct 2 ms 724 KB Output is correct
137 Correct 11 ms 1492 KB Output is correct
138 Correct 13 ms 1492 KB Output is correct
139 Correct 12 ms 596 KB Output is correct
140 Correct 8 ms 596 KB Output is correct
141 Correct 13 ms 1508 KB Output is correct
142 Correct 8 ms 652 KB Output is correct
143 Correct 6 ms 596 KB Output is correct
144 Correct 5 ms 852 KB Output is correct
145 Correct 2 ms 852 KB Output is correct
146 Correct 5 ms 724 KB Output is correct
147 Correct 8 ms 596 KB Output is correct
148 Correct 9 ms 596 KB Output is correct
149 Correct 7 ms 596 KB Output is correct
150 Correct 7 ms 596 KB Output is correct
151 Correct 13 ms 852 KB Output is correct
152 Correct 12 ms 764 KB Output is correct
153 Correct 9 ms 680 KB Output is correct
154 Correct 22 ms 1108 KB Output is correct
155 Correct 7 ms 724 KB Output is correct
156 Correct 27 ms 2512 KB Output is correct
157 Correct 20 ms 980 KB Output is correct
158 Correct 33 ms 4300 KB Output is correct
159 Correct 32 ms 1236 KB Output is correct
160 Correct 20 ms 1108 KB Output is correct
161 Correct 33 ms 4220 KB Output is correct
162 Correct 20 ms 1108 KB Output is correct
163 Correct 17 ms 1112 KB Output is correct
164 Correct 14 ms 1760 KB Output is correct
165 Correct 5 ms 1760 KB Output is correct
166 Correct 12 ms 1364 KB Output is correct
167 Correct 19 ms 1108 KB Output is correct
168 Correct 19 ms 980 KB Output is correct
169 Correct 19 ms 980 KB Output is correct
170 Correct 19 ms 1088 KB Output is correct
171 Correct 32 ms 1396 KB Output is correct
172 Correct 31 ms 1236 KB Output is correct
173 Correct 23 ms 1168 KB Output is correct
174 Correct 32 ms 1364 KB Output is correct
175 Correct 40 ms 2004 KB Output is correct
176 Correct 79 ms 5128 KB Output is correct
177 Correct 125 ms 5588 KB Output is correct
178 Correct 198 ms 7124 KB Output is correct
179 Correct 180 ms 8068 KB Output is correct
180 Correct 195 ms 8020 KB Output is correct
181 Correct 206 ms 8068 KB Output is correct
182 Correct 214 ms 8064 KB Output is correct
183 Correct 311 ms 11140 KB Output is correct
184 Correct 493 ms 15412 KB Output is correct
185 Correct 202 ms 8916 KB Output is correct
186 Correct 482 ms 33968 KB Output is correct
187 Correct 277 ms 11088 KB Output is correct
188 Correct 884 ms 64624 KB Output is correct
189 Correct 648 ms 15736 KB Output is correct
190 Correct 447 ms 15400 KB Output is correct
191 Correct 843 ms 64636 KB Output is correct
192 Correct 455 ms 15476 KB Output is correct
193 Correct 372 ms 15316 KB Output is correct
194 Correct 276 ms 26880 KB Output is correct
195 Correct 103 ms 26800 KB Output is correct
196 Correct 377 ms 15692 KB Output is correct
197 Correct 379 ms 15700 KB Output is correct
198 Correct 399 ms 15628 KB Output is correct
199 Correct 407 ms 15700 KB Output is correct
200 Correct 697 ms 16964 KB Output is correct
201 Correct 673 ms 16232 KB Output is correct
202 Correct 503 ms 15604 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 1 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 0 ms 212 KB Output is correct
8 Correct 0 ms 212 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 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 12 ms 596 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 13 ms 1492 KB Output is correct
22 Correct 12 ms 676 KB Output is correct
23 Correct 8 ms 596 KB Output is correct
24 Correct 6 ms 852 KB Output is correct
25 Correct 2 ms 852 KB Output is correct
26 Correct 13 ms 852 KB Output is correct
27 Correct 13 ms 760 KB Output is correct
28 Correct 9 ms 596 KB Output is correct
29 Correct 23 ms 1104 KB Output is correct
30 Correct 7 ms 724 KB Output is correct
31 Correct 33 ms 4292 KB Output is correct
32 Correct 39 ms 1144 KB Output is correct
33 Correct 20 ms 1108 KB Output is correct
34 Correct 16 ms 1760 KB Output is correct
35 Correct 5 ms 1760 KB Output is correct
36 Correct 36 ms 1364 KB Output is correct
37 Correct 36 ms 1236 KB Output is correct
38 Correct 25 ms 1184 KB Output is correct
39 Correct 253 ms 7912 KB Output is correct
40 Correct 37 ms 1236 KB Output is correct
41 Correct 13 ms 2016 KB Output is correct
42 Correct 36 ms 1364 KB Output is correct
43 Correct 25 ms 2132 KB Output is correct
44 Correct 122 ms 4640 KB Output is correct
45 Correct 96 ms 4976 KB Output is correct
46 Correct 415 ms 32576 KB Output is correct
47 Correct 328 ms 8080 KB Output is correct
48 Correct 234 ms 7864 KB Output is correct
49 Correct 142 ms 13560 KB Output is correct
50 Correct 64 ms 13560 KB Output is correct
51 Correct 365 ms 8656 KB Output is correct
52 Correct 338 ms 8344 KB Output is correct
53 Correct 253 ms 8100 KB Output is correct
54 Correct 0 ms 212 KB Output is correct
55 Correct 1 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 232 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 0 ms 340 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 1 ms 340 KB Output is correct
66 Correct 0 ms 212 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 0 ms 212 KB Output is correct
69 Correct 0 ms 212 KB Output is correct
70 Correct 1 ms 216 KB Output is correct
71 Correct 0 ms 216 KB Output is correct
72 Correct 1 ms 220 KB Output is correct
73 Correct 0 ms 212 KB Output is correct
74 Correct 0 ms 212 KB Output is correct
75 Correct 1 ms 212 KB Output is correct
76 Correct 1 ms 212 KB Output is correct
77 Correct 0 ms 212 KB Output is correct
78 Correct 1 ms 212 KB Output is correct
79 Correct 0 ms 232 KB Output is correct
80 Correct 0 ms 212 KB Output is correct
81 Correct 0 ms 216 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 216 KB Output is correct
85 Correct 1 ms 216 KB Output is correct
86 Correct 0 ms 216 KB Output is correct
87 Correct 0 ms 216 KB Output is correct
88 Correct 0 ms 212 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 1 ms 212 KB Output is correct
91 Correct 0 ms 212 KB Output is correct
92 Correct 1 ms 344 KB Output is correct
93 Correct 0 ms 212 KB Output is correct
94 Correct 1 ms 340 KB Output is correct
95 Correct 0 ms 212 KB Output is correct
96 Correct 0 ms 212 KB Output is correct
97 Correct 0 ms 212 KB Output is correct
98 Correct 0 ms 212 KB Output is correct
99 Correct 0 ms 212 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 0 ms 212 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 0 ms 212 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 0 ms 212 KB Output is correct
106 Correct 0 ms 212 KB Output is correct
107 Correct 1 ms 212 KB Output is correct
108 Correct 0 ms 212 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 6 ms 468 KB Output is correct
111 Correct 12 ms 1412 KB Output is correct
112 Correct 14 ms 1492 KB Output is correct
113 Correct 13 ms 1496 KB Output is correct
114 Correct 9 ms 596 KB Output is correct
115 Correct 6 ms 596 KB Output is correct
116 Correct 8 ms 596 KB Output is correct
117 Correct 13 ms 852 KB Output is correct
118 Correct 12 ms 724 KB Output is correct
119 Correct 27 ms 2512 KB Output is correct
120 Correct 35 ms 4200 KB Output is correct
121 Correct 34 ms 4300 KB Output is correct
122 Correct 20 ms 1104 KB Output is correct
123 Correct 17 ms 1108 KB Output is correct
124 Correct 107 ms 8824 KB Output is correct
125 Correct 344 ms 31536 KB Output is correct
126 Correct 400 ms 32692 KB Output is correct
127 Correct 394 ms 32512 KB Output is correct
128 Correct 208 ms 7892 KB Output is correct
129 Correct 187 ms 7884 KB Output is correct
130 Correct 405 ms 32732 KB Output is correct
131 Correct 415 ms 32768 KB Output is correct
132 Correct 9 ms 596 KB Output is correct
133 Correct 1 ms 340 KB Output is correct
134 Correct 1 ms 340 KB Output is correct
135 Correct 6 ms 468 KB Output is correct
136 Correct 2 ms 724 KB Output is correct
137 Correct 11 ms 1492 KB Output is correct
138 Correct 13 ms 1492 KB Output is correct
139 Correct 12 ms 596 KB Output is correct
140 Correct 8 ms 596 KB Output is correct
141 Correct 13 ms 1508 KB Output is correct
142 Correct 8 ms 652 KB Output is correct
143 Correct 6 ms 596 KB Output is correct
144 Correct 5 ms 852 KB Output is correct
145 Correct 2 ms 852 KB Output is correct
146 Correct 5 ms 724 KB Output is correct
147 Correct 8 ms 596 KB Output is correct
148 Correct 9 ms 596 KB Output is correct
149 Correct 7 ms 596 KB Output is correct
150 Correct 7 ms 596 KB Output is correct
151 Correct 13 ms 852 KB Output is correct
152 Correct 12 ms 764 KB Output is correct
153 Correct 9 ms 680 KB Output is correct
154 Correct 22 ms 1108 KB Output is correct
155 Correct 7 ms 724 KB Output is correct
156 Correct 27 ms 2512 KB Output is correct
157 Correct 20 ms 980 KB Output is correct
158 Correct 33 ms 4300 KB Output is correct
159 Correct 32 ms 1236 KB Output is correct
160 Correct 20 ms 1108 KB Output is correct
161 Correct 33 ms 4220 KB Output is correct
162 Correct 20 ms 1108 KB Output is correct
163 Correct 17 ms 1112 KB Output is correct
164 Correct 14 ms 1760 KB Output is correct
165 Correct 5 ms 1760 KB Output is correct
166 Correct 12 ms 1364 KB Output is correct
167 Correct 19 ms 1108 KB Output is correct
168 Correct 19 ms 980 KB Output is correct
169 Correct 19 ms 980 KB Output is correct
170 Correct 19 ms 1088 KB Output is correct
171 Correct 32 ms 1396 KB Output is correct
172 Correct 31 ms 1236 KB Output is correct
173 Correct 23 ms 1168 KB Output is correct
174 Correct 32 ms 1364 KB Output is correct
175 Correct 40 ms 2004 KB Output is correct
176 Correct 79 ms 5128 KB Output is correct
177 Correct 125 ms 5588 KB Output is correct
178 Correct 198 ms 7124 KB Output is correct
179 Correct 180 ms 8068 KB Output is correct
180 Correct 195 ms 8020 KB Output is correct
181 Correct 206 ms 8068 KB Output is correct
182 Correct 214 ms 8064 KB Output is correct
183 Correct 311 ms 11140 KB Output is correct
184 Correct 493 ms 15412 KB Output is correct
185 Correct 202 ms 8916 KB Output is correct
186 Correct 482 ms 33968 KB Output is correct
187 Correct 277 ms 11088 KB Output is correct
188 Correct 884 ms 64624 KB Output is correct
189 Correct 648 ms 15736 KB Output is correct
190 Correct 447 ms 15400 KB Output is correct
191 Correct 843 ms 64636 KB Output is correct
192 Correct 455 ms 15476 KB Output is correct
193 Correct 372 ms 15316 KB Output is correct
194 Correct 276 ms 26880 KB Output is correct
195 Correct 103 ms 26800 KB Output is correct
196 Correct 377 ms 15692 KB Output is correct
197 Correct 379 ms 15700 KB Output is correct
198 Correct 399 ms 15628 KB Output is correct
199 Correct 407 ms 15700 KB Output is correct
200 Correct 697 ms 16964 KB Output is correct
201 Correct 673 ms 16232 KB Output is correct
202 Correct 503 ms 15604 KB Output is correct
203 Correct 1018 ms 30476 KB Output is correct
204 Correct 393 ms 16176 KB Output is correct
205 Correct 691 ms 19184 KB Output is correct
206 Correct 904 ms 30640 KB Output is correct
207 Correct 1895 ms 128968 KB Output is correct
208 Correct 1349 ms 30984 KB Output is correct
209 Correct 921 ms 30448 KB Output is correct
210 Correct 1873 ms 128912 KB Output is correct
211 Correct 858 ms 30496 KB Output is correct
212 Correct 810 ms 30404 KB Output is correct
213 Correct 568 ms 53256 KB Output is correct
214 Correct 232 ms 53236 KB Output is correct
215 Correct 804 ms 30564 KB Output is correct
216 Correct 776 ms 30676 KB Output is correct
217 Correct 814 ms 31060 KB Output is correct
218 Correct 875 ms 30804 KB Output is correct
219 Correct 1525 ms 55232 KB Output is correct
220 Correct 1863 ms 79816 KB Output is correct
221 Execution timed out 2075 ms 129036 KB Time limit exceeded
222 Halted 0 ms 0 KB -