Submission #832997

# Submission time Handle Problem Language Result Execution time Memory
832997 2023-08-21T18:43:01 Z WLZ Maze (JOI23_ho_t3) C++17
94 / 100
2000 ms 135016 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});
  queue< tuple<int, 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(d, x, y) = q.front(), q.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 + 1) == 0) {
        if (d < dist[nx][ny]) {
          dist[nx][ny] = d;
          q.push({dist[nx][ny], nx, ny});
        }
      } else {
        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:79:3: note: in expansion of macro 'debug'
   79 |   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 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 8 ms 596 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 13 ms 1488 KB Output is correct
22 Correct 11 ms 680 KB Output is correct
23 Correct 7 ms 640 KB Output is correct
24 Correct 5 ms 852 KB Output is correct
25 Correct 2 ms 852 KB Output is correct
26 Correct 12 ms 852 KB Output is correct
27 Correct 12 ms 764 KB Output is correct
28 Correct 8 ms 596 KB Output is correct
29 Correct 19 ms 1108 KB Output is correct
30 Correct 7 ms 796 KB Output is correct
31 Correct 27 ms 4296 KB Output is correct
32 Correct 28 ms 1176 KB Output is correct
33 Correct 18 ms 1112 KB Output is correct
34 Correct 12 ms 1760 KB Output is correct
35 Correct 4 ms 1760 KB Output is correct
36 Correct 31 ms 1364 KB Output is correct
37 Correct 33 ms 1236 KB Output is correct
38 Correct 20 ms 1180 KB Output is correct
39 Correct 215 ms 7908 KB Output is correct
40 Correct 27 ms 1236 KB Output is correct
41 Correct 12 ms 2016 KB Output is correct
42 Correct 32 ms 1364 KB Output is correct
43 Correct 17 ms 2132 KB Output is correct
44 Correct 108 ms 4692 KB Output is correct
45 Correct 72 ms 4976 KB Output is correct
46 Correct 335 ms 32528 KB Output is correct
47 Correct 305 ms 8080 KB Output is correct
48 Correct 187 ms 7884 KB Output is correct
49 Correct 99 ms 13560 KB Output is correct
50 Correct 40 ms 13636 KB Output is correct
51 Correct 352 ms 8704 KB Output is correct
52 Correct 303 ms 8344 KB Output is correct
53 Correct 215 ms 8148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 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 340 KB Output is correct
13 Correct 1 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 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 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 1 ms 212 KB Output is correct
24 Correct 0 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 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 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 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 1 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 0 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 0 ms 212 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 6 ms 468 KB Output is correct
26 Correct 11 ms 1492 KB Output is correct
27 Correct 11 ms 1488 KB Output is correct
28 Correct 10 ms 1492 KB Output is correct
29 Correct 8 ms 640 KB Output is correct
30 Correct 6 ms 596 KB Output is correct
31 Correct 7 ms 596 KB Output is correct
32 Correct 12 ms 852 KB Output is correct
33 Correct 12 ms 852 KB Output is correct
34 Correct 25 ms 2512 KB Output is correct
35 Correct 27 ms 4296 KB Output is correct
36 Correct 28 ms 4300 KB Output is correct
37 Correct 22 ms 1104 KB Output is correct
38 Correct 19 ms 1100 KB Output is correct
39 Correct 111 ms 8744 KB Output is correct
40 Correct 324 ms 31536 KB Output is correct
41 Correct 335 ms 32576 KB Output is correct
42 Correct 328 ms 32588 KB Output is correct
43 Correct 212 ms 8000 KB Output is correct
44 Correct 178 ms 7916 KB Output is correct
45 Correct 388 ms 32688 KB Output is correct
46 Correct 394 ms 32752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 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 340 KB Output is correct
13 Correct 1 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 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 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 1 ms 212 KB Output is correct
24 Correct 0 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 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 8 ms 596 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 0 ms 340 KB Output is correct
36 Correct 6 ms 524 KB Output is correct
37 Correct 2 ms 724 KB Output is correct
38 Correct 10 ms 1492 KB Output is correct
39 Correct 11 ms 1488 KB Output is correct
40 Correct 11 ms 596 KB Output is correct
41 Correct 7 ms 596 KB Output is correct
42 Correct 10 ms 1492 KB Output is correct
43 Correct 8 ms 596 KB Output is correct
44 Correct 8 ms 644 KB Output is correct
45 Correct 6 ms 852 KB Output is correct
46 Correct 2 ms 852 KB Output is correct
47 Correct 4 ms 724 KB Output is correct
48 Correct 8 ms 596 KB Output is correct
49 Correct 8 ms 596 KB Output is correct
50 Correct 7 ms 596 KB Output is correct
51 Correct 8 ms 596 KB Output is correct
52 Correct 12 ms 852 KB Output is correct
53 Correct 12 ms 724 KB Output is correct
54 Correct 7 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 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 340 KB Output is correct
13 Correct 1 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 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 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 1 ms 212 KB Output is correct
24 Correct 0 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 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 8 ms 596 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 0 ms 340 KB Output is correct
36 Correct 6 ms 524 KB Output is correct
37 Correct 2 ms 724 KB Output is correct
38 Correct 10 ms 1492 KB Output is correct
39 Correct 11 ms 1488 KB Output is correct
40 Correct 11 ms 596 KB Output is correct
41 Correct 7 ms 596 KB Output is correct
42 Correct 10 ms 1492 KB Output is correct
43 Correct 8 ms 596 KB Output is correct
44 Correct 8 ms 644 KB Output is correct
45 Correct 6 ms 852 KB Output is correct
46 Correct 2 ms 852 KB Output is correct
47 Correct 4 ms 724 KB Output is correct
48 Correct 8 ms 596 KB Output is correct
49 Correct 8 ms 596 KB Output is correct
50 Correct 7 ms 596 KB Output is correct
51 Correct 8 ms 596 KB Output is correct
52 Correct 12 ms 852 KB Output is correct
53 Correct 12 ms 724 KB Output is correct
54 Correct 7 ms 596 KB Output is correct
55 Correct 19 ms 1100 KB Output is correct
56 Correct 7 ms 724 KB Output is correct
57 Correct 25 ms 2512 KB Output is correct
58 Correct 20 ms 980 KB Output is correct
59 Correct 27 ms 4296 KB Output is correct
60 Correct 28 ms 1168 KB Output is correct
61 Correct 20 ms 1156 KB Output is correct
62 Correct 27 ms 4300 KB Output is correct
63 Correct 20 ms 1112 KB Output is correct
64 Correct 17 ms 1108 KB Output is correct
65 Correct 12 ms 1760 KB Output is correct
66 Correct 4 ms 1760 KB Output is correct
67 Correct 10 ms 1364 KB Output is correct
68 Correct 18 ms 1108 KB Output is correct
69 Correct 20 ms 980 KB Output is correct
70 Correct 19 ms 980 KB Output is correct
71 Correct 20 ms 1208 KB Output is correct
72 Correct 30 ms 1364 KB Output is correct
73 Correct 30 ms 1236 KB Output is correct
74 Correct 19 ms 1180 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 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 8 ms 596 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 13 ms 1488 KB Output is correct
22 Correct 11 ms 680 KB Output is correct
23 Correct 7 ms 640 KB Output is correct
24 Correct 5 ms 852 KB Output is correct
25 Correct 2 ms 852 KB Output is correct
26 Correct 12 ms 852 KB Output is correct
27 Correct 12 ms 764 KB Output is correct
28 Correct 8 ms 596 KB Output is correct
29 Correct 19 ms 1108 KB Output is correct
30 Correct 7 ms 796 KB Output is correct
31 Correct 27 ms 4296 KB Output is correct
32 Correct 28 ms 1176 KB Output is correct
33 Correct 18 ms 1112 KB Output is correct
34 Correct 12 ms 1760 KB Output is correct
35 Correct 4 ms 1760 KB Output is correct
36 Correct 31 ms 1364 KB Output is correct
37 Correct 33 ms 1236 KB Output is correct
38 Correct 20 ms 1180 KB Output is correct
39 Correct 215 ms 7908 KB Output is correct
40 Correct 27 ms 1236 KB Output is correct
41 Correct 12 ms 2016 KB Output is correct
42 Correct 32 ms 1364 KB Output is correct
43 Correct 17 ms 2132 KB Output is correct
44 Correct 108 ms 4692 KB Output is correct
45 Correct 72 ms 4976 KB Output is correct
46 Correct 335 ms 32528 KB Output is correct
47 Correct 305 ms 8080 KB Output is correct
48 Correct 187 ms 7884 KB Output is correct
49 Correct 99 ms 13560 KB Output is correct
50 Correct 40 ms 13636 KB Output is correct
51 Correct 352 ms 8704 KB Output is correct
52 Correct 303 ms 8344 KB Output is correct
53 Correct 215 ms 8148 KB Output is correct
54 Correct 1 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 0 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 0 ms 340 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 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 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 0 ms 212 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 0 ms 212 KB Output is correct
79 Correct 0 ms 212 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 0 ms 212 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 0 ms 340 KB Output is correct
84 Correct 0 ms 212 KB Output is correct
85 Correct 0 ms 212 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 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 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 1 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 0 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 0 ms 212 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 6 ms 468 KB Output is correct
111 Correct 11 ms 1492 KB Output is correct
112 Correct 11 ms 1488 KB Output is correct
113 Correct 10 ms 1492 KB Output is correct
114 Correct 8 ms 640 KB Output is correct
115 Correct 6 ms 596 KB Output is correct
116 Correct 7 ms 596 KB Output is correct
117 Correct 12 ms 852 KB Output is correct
118 Correct 12 ms 852 KB Output is correct
119 Correct 25 ms 2512 KB Output is correct
120 Correct 27 ms 4296 KB Output is correct
121 Correct 28 ms 4300 KB Output is correct
122 Correct 22 ms 1104 KB Output is correct
123 Correct 19 ms 1100 KB Output is correct
124 Correct 111 ms 8744 KB Output is correct
125 Correct 324 ms 31536 KB Output is correct
126 Correct 335 ms 32576 KB Output is correct
127 Correct 328 ms 32588 KB Output is correct
128 Correct 212 ms 8000 KB Output is correct
129 Correct 178 ms 7916 KB Output is correct
130 Correct 388 ms 32688 KB Output is correct
131 Correct 394 ms 32752 KB Output is correct
132 Correct 8 ms 596 KB Output is correct
133 Correct 1 ms 340 KB Output is correct
134 Correct 0 ms 340 KB Output is correct
135 Correct 6 ms 524 KB Output is correct
136 Correct 2 ms 724 KB Output is correct
137 Correct 10 ms 1492 KB Output is correct
138 Correct 11 ms 1488 KB Output is correct
139 Correct 11 ms 596 KB Output is correct
140 Correct 7 ms 596 KB Output is correct
141 Correct 10 ms 1492 KB Output is correct
142 Correct 8 ms 596 KB Output is correct
143 Correct 8 ms 644 KB Output is correct
144 Correct 6 ms 852 KB Output is correct
145 Correct 2 ms 852 KB Output is correct
146 Correct 4 ms 724 KB Output is correct
147 Correct 8 ms 596 KB Output is correct
148 Correct 8 ms 596 KB Output is correct
149 Correct 7 ms 596 KB Output is correct
150 Correct 8 ms 596 KB Output is correct
151 Correct 12 ms 852 KB Output is correct
152 Correct 12 ms 724 KB Output is correct
153 Correct 7 ms 596 KB Output is correct
154 Correct 19 ms 1100 KB Output is correct
155 Correct 7 ms 724 KB Output is correct
156 Correct 25 ms 2512 KB Output is correct
157 Correct 20 ms 980 KB Output is correct
158 Correct 27 ms 4296 KB Output is correct
159 Correct 28 ms 1168 KB Output is correct
160 Correct 20 ms 1156 KB Output is correct
161 Correct 27 ms 4300 KB Output is correct
162 Correct 20 ms 1112 KB Output is correct
163 Correct 17 ms 1108 KB Output is correct
164 Correct 12 ms 1760 KB Output is correct
165 Correct 4 ms 1760 KB Output is correct
166 Correct 10 ms 1364 KB Output is correct
167 Correct 18 ms 1108 KB Output is correct
168 Correct 20 ms 980 KB Output is correct
169 Correct 19 ms 980 KB Output is correct
170 Correct 20 ms 1208 KB Output is correct
171 Correct 30 ms 1364 KB Output is correct
172 Correct 30 ms 1236 KB Output is correct
173 Correct 19 ms 1180 KB Output is correct
174 Correct 30 ms 1364 KB Output is correct
175 Correct 45 ms 2004 KB Output is correct
176 Correct 70 ms 5112 KB Output is correct
177 Correct 126 ms 5588 KB Output is correct
178 Correct 194 ms 7124 KB Output is correct
179 Correct 183 ms 8020 KB Output is correct
180 Correct 197 ms 8020 KB Output is correct
181 Correct 205 ms 8064 KB Output is correct
182 Correct 216 ms 8024 KB Output is correct
183 Correct 315 ms 11144 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 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 8 ms 596 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 13 ms 1488 KB Output is correct
22 Correct 11 ms 680 KB Output is correct
23 Correct 7 ms 640 KB Output is correct
24 Correct 5 ms 852 KB Output is correct
25 Correct 2 ms 852 KB Output is correct
26 Correct 12 ms 852 KB Output is correct
27 Correct 12 ms 764 KB Output is correct
28 Correct 8 ms 596 KB Output is correct
29 Correct 19 ms 1108 KB Output is correct
30 Correct 7 ms 796 KB Output is correct
31 Correct 27 ms 4296 KB Output is correct
32 Correct 28 ms 1176 KB Output is correct
33 Correct 18 ms 1112 KB Output is correct
34 Correct 12 ms 1760 KB Output is correct
35 Correct 4 ms 1760 KB Output is correct
36 Correct 31 ms 1364 KB Output is correct
37 Correct 33 ms 1236 KB Output is correct
38 Correct 20 ms 1180 KB Output is correct
39 Correct 215 ms 7908 KB Output is correct
40 Correct 27 ms 1236 KB Output is correct
41 Correct 12 ms 2016 KB Output is correct
42 Correct 32 ms 1364 KB Output is correct
43 Correct 17 ms 2132 KB Output is correct
44 Correct 108 ms 4692 KB Output is correct
45 Correct 72 ms 4976 KB Output is correct
46 Correct 335 ms 32528 KB Output is correct
47 Correct 305 ms 8080 KB Output is correct
48 Correct 187 ms 7884 KB Output is correct
49 Correct 99 ms 13560 KB Output is correct
50 Correct 40 ms 13636 KB Output is correct
51 Correct 352 ms 8704 KB Output is correct
52 Correct 303 ms 8344 KB Output is correct
53 Correct 215 ms 8148 KB Output is correct
54 Correct 1 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 0 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 0 ms 340 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 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 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 0 ms 212 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 0 ms 212 KB Output is correct
79 Correct 0 ms 212 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 0 ms 212 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 0 ms 340 KB Output is correct
84 Correct 0 ms 212 KB Output is correct
85 Correct 0 ms 212 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 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 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 1 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 0 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 0 ms 212 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 6 ms 468 KB Output is correct
111 Correct 11 ms 1492 KB Output is correct
112 Correct 11 ms 1488 KB Output is correct
113 Correct 10 ms 1492 KB Output is correct
114 Correct 8 ms 640 KB Output is correct
115 Correct 6 ms 596 KB Output is correct
116 Correct 7 ms 596 KB Output is correct
117 Correct 12 ms 852 KB Output is correct
118 Correct 12 ms 852 KB Output is correct
119 Correct 25 ms 2512 KB Output is correct
120 Correct 27 ms 4296 KB Output is correct
121 Correct 28 ms 4300 KB Output is correct
122 Correct 22 ms 1104 KB Output is correct
123 Correct 19 ms 1100 KB Output is correct
124 Correct 111 ms 8744 KB Output is correct
125 Correct 324 ms 31536 KB Output is correct
126 Correct 335 ms 32576 KB Output is correct
127 Correct 328 ms 32588 KB Output is correct
128 Correct 212 ms 8000 KB Output is correct
129 Correct 178 ms 7916 KB Output is correct
130 Correct 388 ms 32688 KB Output is correct
131 Correct 394 ms 32752 KB Output is correct
132 Correct 8 ms 596 KB Output is correct
133 Correct 1 ms 340 KB Output is correct
134 Correct 0 ms 340 KB Output is correct
135 Correct 6 ms 524 KB Output is correct
136 Correct 2 ms 724 KB Output is correct
137 Correct 10 ms 1492 KB Output is correct
138 Correct 11 ms 1488 KB Output is correct
139 Correct 11 ms 596 KB Output is correct
140 Correct 7 ms 596 KB Output is correct
141 Correct 10 ms 1492 KB Output is correct
142 Correct 8 ms 596 KB Output is correct
143 Correct 8 ms 644 KB Output is correct
144 Correct 6 ms 852 KB Output is correct
145 Correct 2 ms 852 KB Output is correct
146 Correct 4 ms 724 KB Output is correct
147 Correct 8 ms 596 KB Output is correct
148 Correct 8 ms 596 KB Output is correct
149 Correct 7 ms 596 KB Output is correct
150 Correct 8 ms 596 KB Output is correct
151 Correct 12 ms 852 KB Output is correct
152 Correct 12 ms 724 KB Output is correct
153 Correct 7 ms 596 KB Output is correct
154 Correct 19 ms 1100 KB Output is correct
155 Correct 7 ms 724 KB Output is correct
156 Correct 25 ms 2512 KB Output is correct
157 Correct 20 ms 980 KB Output is correct
158 Correct 27 ms 4296 KB Output is correct
159 Correct 28 ms 1168 KB Output is correct
160 Correct 20 ms 1156 KB Output is correct
161 Correct 27 ms 4300 KB Output is correct
162 Correct 20 ms 1112 KB Output is correct
163 Correct 17 ms 1108 KB Output is correct
164 Correct 12 ms 1760 KB Output is correct
165 Correct 4 ms 1760 KB Output is correct
166 Correct 10 ms 1364 KB Output is correct
167 Correct 18 ms 1108 KB Output is correct
168 Correct 20 ms 980 KB Output is correct
169 Correct 19 ms 980 KB Output is correct
170 Correct 20 ms 1208 KB Output is correct
171 Correct 30 ms 1364 KB Output is correct
172 Correct 30 ms 1236 KB Output is correct
173 Correct 19 ms 1180 KB Output is correct
174 Correct 30 ms 1364 KB Output is correct
175 Correct 45 ms 2004 KB Output is correct
176 Correct 70 ms 5112 KB Output is correct
177 Correct 126 ms 5588 KB Output is correct
178 Correct 194 ms 7124 KB Output is correct
179 Correct 183 ms 8020 KB Output is correct
180 Correct 197 ms 8020 KB Output is correct
181 Correct 205 ms 8064 KB Output is correct
182 Correct 216 ms 8024 KB Output is correct
183 Correct 315 ms 11144 KB Output is correct
184 Correct 431 ms 15400 KB Output is correct
185 Correct 202 ms 8872 KB Output is correct
186 Correct 447 ms 33856 KB Output is correct
187 Correct 275 ms 11076 KB Output is correct
188 Correct 758 ms 64716 KB Output is correct
189 Correct 598 ms 15640 KB Output is correct
190 Correct 389 ms 15392 KB Output is correct
191 Correct 761 ms 64632 KB Output is correct
192 Correct 465 ms 15476 KB Output is correct
193 Correct 367 ms 15412 KB Output is correct
194 Correct 207 ms 26872 KB Output is correct
195 Correct 73 ms 26880 KB Output is correct
196 Correct 369 ms 15700 KB Output is correct
197 Correct 366 ms 15664 KB Output is correct
198 Correct 395 ms 15640 KB Output is correct
199 Correct 421 ms 15700 KB Output is correct
200 Correct 683 ms 16908 KB Output is correct
201 Correct 638 ms 16204 KB Output is correct
202 Correct 446 ms 15632 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 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 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 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 8 ms 596 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 13 ms 1488 KB Output is correct
22 Correct 11 ms 680 KB Output is correct
23 Correct 7 ms 640 KB Output is correct
24 Correct 5 ms 852 KB Output is correct
25 Correct 2 ms 852 KB Output is correct
26 Correct 12 ms 852 KB Output is correct
27 Correct 12 ms 764 KB Output is correct
28 Correct 8 ms 596 KB Output is correct
29 Correct 19 ms 1108 KB Output is correct
30 Correct 7 ms 796 KB Output is correct
31 Correct 27 ms 4296 KB Output is correct
32 Correct 28 ms 1176 KB Output is correct
33 Correct 18 ms 1112 KB Output is correct
34 Correct 12 ms 1760 KB Output is correct
35 Correct 4 ms 1760 KB Output is correct
36 Correct 31 ms 1364 KB Output is correct
37 Correct 33 ms 1236 KB Output is correct
38 Correct 20 ms 1180 KB Output is correct
39 Correct 215 ms 7908 KB Output is correct
40 Correct 27 ms 1236 KB Output is correct
41 Correct 12 ms 2016 KB Output is correct
42 Correct 32 ms 1364 KB Output is correct
43 Correct 17 ms 2132 KB Output is correct
44 Correct 108 ms 4692 KB Output is correct
45 Correct 72 ms 4976 KB Output is correct
46 Correct 335 ms 32528 KB Output is correct
47 Correct 305 ms 8080 KB Output is correct
48 Correct 187 ms 7884 KB Output is correct
49 Correct 99 ms 13560 KB Output is correct
50 Correct 40 ms 13636 KB Output is correct
51 Correct 352 ms 8704 KB Output is correct
52 Correct 303 ms 8344 KB Output is correct
53 Correct 215 ms 8148 KB Output is correct
54 Correct 1 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 0 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 0 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 0 ms 340 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 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 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 0 ms 212 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 0 ms 212 KB Output is correct
79 Correct 0 ms 212 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 0 ms 212 KB Output is correct
82 Correct 1 ms 212 KB Output is correct
83 Correct 0 ms 340 KB Output is correct
84 Correct 0 ms 212 KB Output is correct
85 Correct 0 ms 212 KB Output is correct
86 Correct 0 ms 212 KB Output is correct
87 Correct 0 ms 212 KB Output is correct
88 Correct 0 ms 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 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 1 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 0 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 0 ms 212 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 6 ms 468 KB Output is correct
111 Correct 11 ms 1492 KB Output is correct
112 Correct 11 ms 1488 KB Output is correct
113 Correct 10 ms 1492 KB Output is correct
114 Correct 8 ms 640 KB Output is correct
115 Correct 6 ms 596 KB Output is correct
116 Correct 7 ms 596 KB Output is correct
117 Correct 12 ms 852 KB Output is correct
118 Correct 12 ms 852 KB Output is correct
119 Correct 25 ms 2512 KB Output is correct
120 Correct 27 ms 4296 KB Output is correct
121 Correct 28 ms 4300 KB Output is correct
122 Correct 22 ms 1104 KB Output is correct
123 Correct 19 ms 1100 KB Output is correct
124 Correct 111 ms 8744 KB Output is correct
125 Correct 324 ms 31536 KB Output is correct
126 Correct 335 ms 32576 KB Output is correct
127 Correct 328 ms 32588 KB Output is correct
128 Correct 212 ms 8000 KB Output is correct
129 Correct 178 ms 7916 KB Output is correct
130 Correct 388 ms 32688 KB Output is correct
131 Correct 394 ms 32752 KB Output is correct
132 Correct 8 ms 596 KB Output is correct
133 Correct 1 ms 340 KB Output is correct
134 Correct 0 ms 340 KB Output is correct
135 Correct 6 ms 524 KB Output is correct
136 Correct 2 ms 724 KB Output is correct
137 Correct 10 ms 1492 KB Output is correct
138 Correct 11 ms 1488 KB Output is correct
139 Correct 11 ms 596 KB Output is correct
140 Correct 7 ms 596 KB Output is correct
141 Correct 10 ms 1492 KB Output is correct
142 Correct 8 ms 596 KB Output is correct
143 Correct 8 ms 644 KB Output is correct
144 Correct 6 ms 852 KB Output is correct
145 Correct 2 ms 852 KB Output is correct
146 Correct 4 ms 724 KB Output is correct
147 Correct 8 ms 596 KB Output is correct
148 Correct 8 ms 596 KB Output is correct
149 Correct 7 ms 596 KB Output is correct
150 Correct 8 ms 596 KB Output is correct
151 Correct 12 ms 852 KB Output is correct
152 Correct 12 ms 724 KB Output is correct
153 Correct 7 ms 596 KB Output is correct
154 Correct 19 ms 1100 KB Output is correct
155 Correct 7 ms 724 KB Output is correct
156 Correct 25 ms 2512 KB Output is correct
157 Correct 20 ms 980 KB Output is correct
158 Correct 27 ms 4296 KB Output is correct
159 Correct 28 ms 1168 KB Output is correct
160 Correct 20 ms 1156 KB Output is correct
161 Correct 27 ms 4300 KB Output is correct
162 Correct 20 ms 1112 KB Output is correct
163 Correct 17 ms 1108 KB Output is correct
164 Correct 12 ms 1760 KB Output is correct
165 Correct 4 ms 1760 KB Output is correct
166 Correct 10 ms 1364 KB Output is correct
167 Correct 18 ms 1108 KB Output is correct
168 Correct 20 ms 980 KB Output is correct
169 Correct 19 ms 980 KB Output is correct
170 Correct 20 ms 1208 KB Output is correct
171 Correct 30 ms 1364 KB Output is correct
172 Correct 30 ms 1236 KB Output is correct
173 Correct 19 ms 1180 KB Output is correct
174 Correct 30 ms 1364 KB Output is correct
175 Correct 45 ms 2004 KB Output is correct
176 Correct 70 ms 5112 KB Output is correct
177 Correct 126 ms 5588 KB Output is correct
178 Correct 194 ms 7124 KB Output is correct
179 Correct 183 ms 8020 KB Output is correct
180 Correct 197 ms 8020 KB Output is correct
181 Correct 205 ms 8064 KB Output is correct
182 Correct 216 ms 8024 KB Output is correct
183 Correct 315 ms 11144 KB Output is correct
184 Correct 431 ms 15400 KB Output is correct
185 Correct 202 ms 8872 KB Output is correct
186 Correct 447 ms 33856 KB Output is correct
187 Correct 275 ms 11076 KB Output is correct
188 Correct 758 ms 64716 KB Output is correct
189 Correct 598 ms 15640 KB Output is correct
190 Correct 389 ms 15392 KB Output is correct
191 Correct 761 ms 64632 KB Output is correct
192 Correct 465 ms 15476 KB Output is correct
193 Correct 367 ms 15412 KB Output is correct
194 Correct 207 ms 26872 KB Output is correct
195 Correct 73 ms 26880 KB Output is correct
196 Correct 369 ms 15700 KB Output is correct
197 Correct 366 ms 15664 KB Output is correct
198 Correct 395 ms 15640 KB Output is correct
199 Correct 421 ms 15700 KB Output is correct
200 Correct 683 ms 16908 KB Output is correct
201 Correct 638 ms 16204 KB Output is correct
202 Correct 446 ms 15632 KB Output is correct
203 Correct 905 ms 30412 KB Output is correct
204 Correct 400 ms 16188 KB Output is correct
205 Correct 678 ms 19200 KB Output is correct
206 Correct 773 ms 30712 KB Output is correct
207 Correct 1738 ms 128860 KB Output is correct
208 Correct 1250 ms 36756 KB Output is correct
209 Correct 852 ms 36284 KB Output is correct
210 Correct 1762 ms 134752 KB Output is correct
211 Correct 859 ms 36356 KB Output is correct
212 Correct 836 ms 36432 KB Output is correct
213 Correct 449 ms 59128 KB Output is correct
214 Correct 186 ms 59120 KB Output is correct
215 Correct 816 ms 36440 KB Output is correct
216 Correct 826 ms 36544 KB Output is correct
217 Correct 850 ms 36936 KB Output is correct
218 Correct 888 ms 36800 KB Output is correct
219 Correct 1489 ms 61156 KB Output is correct
220 Correct 1805 ms 85708 KB Output is correct
221 Execution timed out 2054 ms 135016 KB Time limit exceeded
222 Halted 0 ms 0 KB -