Submission #833014

# Submission time Handle Problem Language Result Execution time Memory
833014 2023-08-21T19:15:04 Z WLZ Maze (JOI23_ho_t3) C++17
100 / 100
946 ms 99492 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});
  deque< pair<int, int> > q, q2; q.push_front({sr, sc});
  while (!q.empty() || !q2.empty()) {
    int d, x, y;
    if (q.empty()) swap(q, q2);
    if (q.empty()) tie(x, y) = q2.front(), q2.pop_front();
    else {
      tie(x, y) = q.front(); q.pop_front();
    }
    d = dist[x][y];
    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;
        q.push_back({nx, ny});
      }
      if (k >= 4) continue;
      if (d % (n + 1) == 0 && d + 1 < dist[nx][ny]) {
        dist[nx][ny] = d + 1;
        q.push_back({nx, ny});
      }
      if (d % (n + 1) == n && d + 2 < dist[nx][ny]) {
        dist[nx][ny] = d + 2;
        q2.push_front({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_front({nx, ny});
        else q2.push_back({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 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 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 1 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 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 5 ms 640 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 9 ms 1108 KB Output is correct
22 Correct 8 ms 656 KB Output is correct
23 Correct 4 ms 632 KB Output is correct
24 Correct 6 ms 852 KB Output is correct
25 Correct 4 ms 852 KB Output is correct
26 Correct 8 ms 596 KB Output is correct
27 Correct 8 ms 664 KB Output is correct
28 Correct 4 ms 648 KB Output is correct
29 Correct 12 ms 1100 KB Output is correct
30 Correct 6 ms 724 KB Output is correct
31 Correct 23 ms 2880 KB Output is correct
32 Correct 18 ms 1120 KB Output is correct
33 Correct 11 ms 1092 KB Output is correct
34 Correct 13 ms 1760 KB Output is correct
35 Correct 6 ms 1760 KB Output is correct
36 Correct 19 ms 1220 KB Output is correct
37 Correct 18 ms 1108 KB Output is correct
38 Correct 11 ms 1120 KB Output is correct
39 Correct 127 ms 7872 KB Output is correct
40 Correct 23 ms 1236 KB Output is correct
41 Correct 17 ms 2016 KB Output is correct
42 Correct 20 ms 1364 KB Output is correct
43 Correct 23 ms 2132 KB Output is correct
44 Correct 111 ms 4692 KB Output is correct
45 Correct 75 ms 4976 KB Output is correct
46 Correct 232 ms 23476 KB Output is correct
47 Correct 190 ms 7872 KB Output is correct
48 Correct 109 ms 7860 KB Output is correct
49 Correct 135 ms 13560 KB Output is correct
50 Correct 69 ms 13560 KB Output is correct
51 Correct 192 ms 8316 KB Output is correct
52 Correct 187 ms 8036 KB Output is correct
53 Correct 111 ms 7924 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 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 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 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 0 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 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 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 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 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 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 0 ms 212 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 4 ms 468 KB Output is correct
26 Correct 7 ms 980 KB Output is correct
27 Correct 9 ms 1108 KB Output is correct
28 Correct 9 ms 1364 KB Output is correct
29 Correct 4 ms 596 KB Output is correct
30 Correct 3 ms 596 KB Output is correct
31 Correct 4 ms 596 KB Output is correct
32 Correct 8 ms 852 KB Output is correct
33 Correct 7 ms 596 KB Output is correct
34 Correct 16 ms 1876 KB Output is correct
35 Correct 23 ms 2784 KB Output is correct
36 Correct 23 ms 2800 KB Output is correct
37 Correct 10 ms 980 KB Output is correct
38 Correct 6 ms 1100 KB Output is correct
39 Correct 56 ms 6048 KB Output is correct
40 Correct 164 ms 17044 KB Output is correct
41 Correct 233 ms 23468 KB Output is correct
42 Correct 232 ms 22928 KB Output is correct
43 Correct 93 ms 7864 KB Output is correct
44 Correct 61 ms 7856 KB Output is correct
45 Correct 189 ms 19324 KB Output is correct
46 Correct 194 ms 19684 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 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 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 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 0 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 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 5 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 4 ms 468 KB Output is correct
37 Correct 2 ms 724 KB Output is correct
38 Correct 8 ms 980 KB Output is correct
39 Correct 9 ms 1152 KB Output is correct
40 Correct 8 ms 596 KB Output is correct
41 Correct 4 ms 596 KB Output is correct
42 Correct 9 ms 1364 KB Output is correct
43 Correct 4 ms 596 KB Output is correct
44 Correct 3 ms 596 KB Output is correct
45 Correct 6 ms 852 KB Output is correct
46 Correct 3 ms 852 KB Output is correct
47 Correct 5 ms 724 KB Output is correct
48 Correct 5 ms 632 KB Output is correct
49 Correct 5 ms 596 KB Output is correct
50 Correct 4 ms 596 KB Output is correct
51 Correct 4 ms 596 KB Output is correct
52 Correct 8 ms 716 KB Output is correct
53 Correct 8 ms 672 KB Output is correct
54 Correct 5 ms 652 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 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 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 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 0 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 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 5 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 4 ms 468 KB Output is correct
37 Correct 2 ms 724 KB Output is correct
38 Correct 8 ms 980 KB Output is correct
39 Correct 9 ms 1152 KB Output is correct
40 Correct 8 ms 596 KB Output is correct
41 Correct 4 ms 596 KB Output is correct
42 Correct 9 ms 1364 KB Output is correct
43 Correct 4 ms 596 KB Output is correct
44 Correct 3 ms 596 KB Output is correct
45 Correct 6 ms 852 KB Output is correct
46 Correct 3 ms 852 KB Output is correct
47 Correct 5 ms 724 KB Output is correct
48 Correct 5 ms 632 KB Output is correct
49 Correct 5 ms 596 KB Output is correct
50 Correct 4 ms 596 KB Output is correct
51 Correct 4 ms 596 KB Output is correct
52 Correct 8 ms 716 KB Output is correct
53 Correct 8 ms 672 KB Output is correct
54 Correct 5 ms 652 KB Output is correct
55 Correct 12 ms 980 KB Output is correct
56 Correct 6 ms 724 KB Output is correct
57 Correct 18 ms 1880 KB Output is correct
58 Correct 13 ms 980 KB Output is correct
59 Correct 23 ms 2772 KB Output is correct
60 Correct 18 ms 1108 KB Output is correct
61 Correct 11 ms 1100 KB Output is correct
62 Correct 23 ms 2808 KB Output is correct
63 Correct 10 ms 980 KB Output is correct
64 Correct 6 ms 980 KB Output is correct
65 Correct 14 ms 1760 KB Output is correct
66 Correct 5 ms 1760 KB Output is correct
67 Correct 13 ms 1364 KB Output is correct
68 Correct 11 ms 1108 KB Output is correct
69 Correct 11 ms 980 KB Output is correct
70 Correct 10 ms 980 KB Output is correct
71 Correct 10 ms 980 KB Output is correct
72 Correct 19 ms 1220 KB Output is correct
73 Correct 18 ms 1164 KB Output is correct
74 Correct 10 ms 1124 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 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 1 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 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 5 ms 640 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 9 ms 1108 KB Output is correct
22 Correct 8 ms 656 KB Output is correct
23 Correct 4 ms 632 KB Output is correct
24 Correct 6 ms 852 KB Output is correct
25 Correct 4 ms 852 KB Output is correct
26 Correct 8 ms 596 KB Output is correct
27 Correct 8 ms 664 KB Output is correct
28 Correct 4 ms 648 KB Output is correct
29 Correct 12 ms 1100 KB Output is correct
30 Correct 6 ms 724 KB Output is correct
31 Correct 23 ms 2880 KB Output is correct
32 Correct 18 ms 1120 KB Output is correct
33 Correct 11 ms 1092 KB Output is correct
34 Correct 13 ms 1760 KB Output is correct
35 Correct 6 ms 1760 KB Output is correct
36 Correct 19 ms 1220 KB Output is correct
37 Correct 18 ms 1108 KB Output is correct
38 Correct 11 ms 1120 KB Output is correct
39 Correct 127 ms 7872 KB Output is correct
40 Correct 23 ms 1236 KB Output is correct
41 Correct 17 ms 2016 KB Output is correct
42 Correct 20 ms 1364 KB Output is correct
43 Correct 23 ms 2132 KB Output is correct
44 Correct 111 ms 4692 KB Output is correct
45 Correct 75 ms 4976 KB Output is correct
46 Correct 232 ms 23476 KB Output is correct
47 Correct 190 ms 7872 KB Output is correct
48 Correct 109 ms 7860 KB Output is correct
49 Correct 135 ms 13560 KB Output is correct
50 Correct 69 ms 13560 KB Output is correct
51 Correct 192 ms 8316 KB Output is correct
52 Correct 187 ms 8036 KB Output is correct
53 Correct 111 ms 7924 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 0 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 0 ms 212 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 212 KB Output is correct
66 Correct 0 ms 212 KB Output is correct
67 Correct 0 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 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 0 ms 212 KB Output is correct
76 Correct 0 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 0 ms 212 KB Output is correct
81 Correct 0 ms 212 KB Output is correct
82 Correct 0 ms 212 KB Output is correct
83 Correct 0 ms 212 KB Output is correct
84 Correct 1 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 0 ms 212 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 1 ms 212 KB Output is correct
95 Correct 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 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 0 ms 212 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 4 ms 468 KB Output is correct
111 Correct 7 ms 980 KB Output is correct
112 Correct 9 ms 1108 KB Output is correct
113 Correct 9 ms 1364 KB Output is correct
114 Correct 4 ms 596 KB Output is correct
115 Correct 3 ms 596 KB Output is correct
116 Correct 4 ms 596 KB Output is correct
117 Correct 8 ms 852 KB Output is correct
118 Correct 7 ms 596 KB Output is correct
119 Correct 16 ms 1876 KB Output is correct
120 Correct 23 ms 2784 KB Output is correct
121 Correct 23 ms 2800 KB Output is correct
122 Correct 10 ms 980 KB Output is correct
123 Correct 6 ms 1100 KB Output is correct
124 Correct 56 ms 6048 KB Output is correct
125 Correct 164 ms 17044 KB Output is correct
126 Correct 233 ms 23468 KB Output is correct
127 Correct 232 ms 22928 KB Output is correct
128 Correct 93 ms 7864 KB Output is correct
129 Correct 61 ms 7856 KB Output is correct
130 Correct 189 ms 19324 KB Output is correct
131 Correct 194 ms 19684 KB Output is correct
132 Correct 5 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 4 ms 468 KB Output is correct
136 Correct 2 ms 724 KB Output is correct
137 Correct 8 ms 980 KB Output is correct
138 Correct 9 ms 1152 KB Output is correct
139 Correct 8 ms 596 KB Output is correct
140 Correct 4 ms 596 KB Output is correct
141 Correct 9 ms 1364 KB Output is correct
142 Correct 4 ms 596 KB Output is correct
143 Correct 3 ms 596 KB Output is correct
144 Correct 6 ms 852 KB Output is correct
145 Correct 3 ms 852 KB Output is correct
146 Correct 5 ms 724 KB Output is correct
147 Correct 5 ms 632 KB Output is correct
148 Correct 5 ms 596 KB Output is correct
149 Correct 4 ms 596 KB Output is correct
150 Correct 4 ms 596 KB Output is correct
151 Correct 8 ms 716 KB Output is correct
152 Correct 8 ms 672 KB Output is correct
153 Correct 5 ms 652 KB Output is correct
154 Correct 12 ms 980 KB Output is correct
155 Correct 6 ms 724 KB Output is correct
156 Correct 18 ms 1880 KB Output is correct
157 Correct 13 ms 980 KB Output is correct
158 Correct 23 ms 2772 KB Output is correct
159 Correct 18 ms 1108 KB Output is correct
160 Correct 11 ms 1100 KB Output is correct
161 Correct 23 ms 2808 KB Output is correct
162 Correct 10 ms 980 KB Output is correct
163 Correct 6 ms 980 KB Output is correct
164 Correct 14 ms 1760 KB Output is correct
165 Correct 5 ms 1760 KB Output is correct
166 Correct 13 ms 1364 KB Output is correct
167 Correct 11 ms 1108 KB Output is correct
168 Correct 11 ms 980 KB Output is correct
169 Correct 10 ms 980 KB Output is correct
170 Correct 10 ms 980 KB Output is correct
171 Correct 19 ms 1220 KB Output is correct
172 Correct 18 ms 1164 KB Output is correct
173 Correct 10 ms 1124 KB Output is correct
174 Correct 23 ms 1364 KB Output is correct
175 Correct 22 ms 2004 KB Output is correct
176 Correct 71 ms 5192 KB Output is correct
177 Correct 73 ms 5596 KB Output is correct
178 Correct 110 ms 7092 KB Output is correct
179 Correct 104 ms 8020 KB Output is correct
180 Correct 101 ms 8020 KB Output is correct
181 Correct 102 ms 8020 KB Output is correct
182 Correct 98 ms 8020 KB Output is correct
183 Correct 183 ms 9536 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 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 1 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 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 5 ms 640 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 9 ms 1108 KB Output is correct
22 Correct 8 ms 656 KB Output is correct
23 Correct 4 ms 632 KB Output is correct
24 Correct 6 ms 852 KB Output is correct
25 Correct 4 ms 852 KB Output is correct
26 Correct 8 ms 596 KB Output is correct
27 Correct 8 ms 664 KB Output is correct
28 Correct 4 ms 648 KB Output is correct
29 Correct 12 ms 1100 KB Output is correct
30 Correct 6 ms 724 KB Output is correct
31 Correct 23 ms 2880 KB Output is correct
32 Correct 18 ms 1120 KB Output is correct
33 Correct 11 ms 1092 KB Output is correct
34 Correct 13 ms 1760 KB Output is correct
35 Correct 6 ms 1760 KB Output is correct
36 Correct 19 ms 1220 KB Output is correct
37 Correct 18 ms 1108 KB Output is correct
38 Correct 11 ms 1120 KB Output is correct
39 Correct 127 ms 7872 KB Output is correct
40 Correct 23 ms 1236 KB Output is correct
41 Correct 17 ms 2016 KB Output is correct
42 Correct 20 ms 1364 KB Output is correct
43 Correct 23 ms 2132 KB Output is correct
44 Correct 111 ms 4692 KB Output is correct
45 Correct 75 ms 4976 KB Output is correct
46 Correct 232 ms 23476 KB Output is correct
47 Correct 190 ms 7872 KB Output is correct
48 Correct 109 ms 7860 KB Output is correct
49 Correct 135 ms 13560 KB Output is correct
50 Correct 69 ms 13560 KB Output is correct
51 Correct 192 ms 8316 KB Output is correct
52 Correct 187 ms 8036 KB Output is correct
53 Correct 111 ms 7924 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 0 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 0 ms 212 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 212 KB Output is correct
66 Correct 0 ms 212 KB Output is correct
67 Correct 0 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 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 0 ms 212 KB Output is correct
76 Correct 0 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 0 ms 212 KB Output is correct
81 Correct 0 ms 212 KB Output is correct
82 Correct 0 ms 212 KB Output is correct
83 Correct 0 ms 212 KB Output is correct
84 Correct 1 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 0 ms 212 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 1 ms 212 KB Output is correct
95 Correct 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 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 0 ms 212 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 4 ms 468 KB Output is correct
111 Correct 7 ms 980 KB Output is correct
112 Correct 9 ms 1108 KB Output is correct
113 Correct 9 ms 1364 KB Output is correct
114 Correct 4 ms 596 KB Output is correct
115 Correct 3 ms 596 KB Output is correct
116 Correct 4 ms 596 KB Output is correct
117 Correct 8 ms 852 KB Output is correct
118 Correct 7 ms 596 KB Output is correct
119 Correct 16 ms 1876 KB Output is correct
120 Correct 23 ms 2784 KB Output is correct
121 Correct 23 ms 2800 KB Output is correct
122 Correct 10 ms 980 KB Output is correct
123 Correct 6 ms 1100 KB Output is correct
124 Correct 56 ms 6048 KB Output is correct
125 Correct 164 ms 17044 KB Output is correct
126 Correct 233 ms 23468 KB Output is correct
127 Correct 232 ms 22928 KB Output is correct
128 Correct 93 ms 7864 KB Output is correct
129 Correct 61 ms 7856 KB Output is correct
130 Correct 189 ms 19324 KB Output is correct
131 Correct 194 ms 19684 KB Output is correct
132 Correct 5 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 4 ms 468 KB Output is correct
136 Correct 2 ms 724 KB Output is correct
137 Correct 8 ms 980 KB Output is correct
138 Correct 9 ms 1152 KB Output is correct
139 Correct 8 ms 596 KB Output is correct
140 Correct 4 ms 596 KB Output is correct
141 Correct 9 ms 1364 KB Output is correct
142 Correct 4 ms 596 KB Output is correct
143 Correct 3 ms 596 KB Output is correct
144 Correct 6 ms 852 KB Output is correct
145 Correct 3 ms 852 KB Output is correct
146 Correct 5 ms 724 KB Output is correct
147 Correct 5 ms 632 KB Output is correct
148 Correct 5 ms 596 KB Output is correct
149 Correct 4 ms 596 KB Output is correct
150 Correct 4 ms 596 KB Output is correct
151 Correct 8 ms 716 KB Output is correct
152 Correct 8 ms 672 KB Output is correct
153 Correct 5 ms 652 KB Output is correct
154 Correct 12 ms 980 KB Output is correct
155 Correct 6 ms 724 KB Output is correct
156 Correct 18 ms 1880 KB Output is correct
157 Correct 13 ms 980 KB Output is correct
158 Correct 23 ms 2772 KB Output is correct
159 Correct 18 ms 1108 KB Output is correct
160 Correct 11 ms 1100 KB Output is correct
161 Correct 23 ms 2808 KB Output is correct
162 Correct 10 ms 980 KB Output is correct
163 Correct 6 ms 980 KB Output is correct
164 Correct 14 ms 1760 KB Output is correct
165 Correct 5 ms 1760 KB Output is correct
166 Correct 13 ms 1364 KB Output is correct
167 Correct 11 ms 1108 KB Output is correct
168 Correct 11 ms 980 KB Output is correct
169 Correct 10 ms 980 KB Output is correct
170 Correct 10 ms 980 KB Output is correct
171 Correct 19 ms 1220 KB Output is correct
172 Correct 18 ms 1164 KB Output is correct
173 Correct 10 ms 1124 KB Output is correct
174 Correct 23 ms 1364 KB Output is correct
175 Correct 22 ms 2004 KB Output is correct
176 Correct 71 ms 5192 KB Output is correct
177 Correct 73 ms 5596 KB Output is correct
178 Correct 110 ms 7092 KB Output is correct
179 Correct 104 ms 8020 KB Output is correct
180 Correct 101 ms 8020 KB Output is correct
181 Correct 102 ms 8020 KB Output is correct
182 Correct 98 ms 8020 KB Output is correct
183 Correct 183 ms 9536 KB Output is correct
184 Correct 248 ms 15340 KB Output is correct
185 Correct 114 ms 8916 KB Output is correct
186 Correct 231 ms 23196 KB Output is correct
187 Correct 102 ms 11060 KB Output is correct
188 Correct 465 ms 45232 KB Output is correct
189 Correct 400 ms 15508 KB Output is correct
190 Correct 223 ms 15316 KB Output is correct
191 Correct 469 ms 47952 KB Output is correct
192 Correct 194 ms 15316 KB Output is correct
193 Correct 129 ms 15336 KB Output is correct
194 Correct 275 ms 26820 KB Output is correct
195 Correct 107 ms 26880 KB Output is correct
196 Correct 205 ms 15700 KB Output is correct
197 Correct 203 ms 15748 KB Output is correct
198 Correct 215 ms 15572 KB Output is correct
199 Correct 203 ms 15692 KB Output is correct
200 Correct 389 ms 16116 KB Output is correct
201 Correct 377 ms 15644 KB Output is correct
202 Correct 228 ms 15464 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 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 1 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 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 5 ms 640 KB Output is correct
20 Correct 2 ms 724 KB Output is correct
21 Correct 9 ms 1108 KB Output is correct
22 Correct 8 ms 656 KB Output is correct
23 Correct 4 ms 632 KB Output is correct
24 Correct 6 ms 852 KB Output is correct
25 Correct 4 ms 852 KB Output is correct
26 Correct 8 ms 596 KB Output is correct
27 Correct 8 ms 664 KB Output is correct
28 Correct 4 ms 648 KB Output is correct
29 Correct 12 ms 1100 KB Output is correct
30 Correct 6 ms 724 KB Output is correct
31 Correct 23 ms 2880 KB Output is correct
32 Correct 18 ms 1120 KB Output is correct
33 Correct 11 ms 1092 KB Output is correct
34 Correct 13 ms 1760 KB Output is correct
35 Correct 6 ms 1760 KB Output is correct
36 Correct 19 ms 1220 KB Output is correct
37 Correct 18 ms 1108 KB Output is correct
38 Correct 11 ms 1120 KB Output is correct
39 Correct 127 ms 7872 KB Output is correct
40 Correct 23 ms 1236 KB Output is correct
41 Correct 17 ms 2016 KB Output is correct
42 Correct 20 ms 1364 KB Output is correct
43 Correct 23 ms 2132 KB Output is correct
44 Correct 111 ms 4692 KB Output is correct
45 Correct 75 ms 4976 KB Output is correct
46 Correct 232 ms 23476 KB Output is correct
47 Correct 190 ms 7872 KB Output is correct
48 Correct 109 ms 7860 KB Output is correct
49 Correct 135 ms 13560 KB Output is correct
50 Correct 69 ms 13560 KB Output is correct
51 Correct 192 ms 8316 KB Output is correct
52 Correct 187 ms 8036 KB Output is correct
53 Correct 111 ms 7924 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 0 ms 212 KB Output is correct
61 Correct 0 ms 212 KB Output is correct
62 Correct 0 ms 212 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 212 KB Output is correct
66 Correct 0 ms 212 KB Output is correct
67 Correct 0 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 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 0 ms 212 KB Output is correct
76 Correct 0 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 0 ms 212 KB Output is correct
81 Correct 0 ms 212 KB Output is correct
82 Correct 0 ms 212 KB Output is correct
83 Correct 0 ms 212 KB Output is correct
84 Correct 1 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 0 ms 212 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 1 ms 212 KB Output is correct
95 Correct 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 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 0 ms 212 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 4 ms 468 KB Output is correct
111 Correct 7 ms 980 KB Output is correct
112 Correct 9 ms 1108 KB Output is correct
113 Correct 9 ms 1364 KB Output is correct
114 Correct 4 ms 596 KB Output is correct
115 Correct 3 ms 596 KB Output is correct
116 Correct 4 ms 596 KB Output is correct
117 Correct 8 ms 852 KB Output is correct
118 Correct 7 ms 596 KB Output is correct
119 Correct 16 ms 1876 KB Output is correct
120 Correct 23 ms 2784 KB Output is correct
121 Correct 23 ms 2800 KB Output is correct
122 Correct 10 ms 980 KB Output is correct
123 Correct 6 ms 1100 KB Output is correct
124 Correct 56 ms 6048 KB Output is correct
125 Correct 164 ms 17044 KB Output is correct
126 Correct 233 ms 23468 KB Output is correct
127 Correct 232 ms 22928 KB Output is correct
128 Correct 93 ms 7864 KB Output is correct
129 Correct 61 ms 7856 KB Output is correct
130 Correct 189 ms 19324 KB Output is correct
131 Correct 194 ms 19684 KB Output is correct
132 Correct 5 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 4 ms 468 KB Output is correct
136 Correct 2 ms 724 KB Output is correct
137 Correct 8 ms 980 KB Output is correct
138 Correct 9 ms 1152 KB Output is correct
139 Correct 8 ms 596 KB Output is correct
140 Correct 4 ms 596 KB Output is correct
141 Correct 9 ms 1364 KB Output is correct
142 Correct 4 ms 596 KB Output is correct
143 Correct 3 ms 596 KB Output is correct
144 Correct 6 ms 852 KB Output is correct
145 Correct 3 ms 852 KB Output is correct
146 Correct 5 ms 724 KB Output is correct
147 Correct 5 ms 632 KB Output is correct
148 Correct 5 ms 596 KB Output is correct
149 Correct 4 ms 596 KB Output is correct
150 Correct 4 ms 596 KB Output is correct
151 Correct 8 ms 716 KB Output is correct
152 Correct 8 ms 672 KB Output is correct
153 Correct 5 ms 652 KB Output is correct
154 Correct 12 ms 980 KB Output is correct
155 Correct 6 ms 724 KB Output is correct
156 Correct 18 ms 1880 KB Output is correct
157 Correct 13 ms 980 KB Output is correct
158 Correct 23 ms 2772 KB Output is correct
159 Correct 18 ms 1108 KB Output is correct
160 Correct 11 ms 1100 KB Output is correct
161 Correct 23 ms 2808 KB Output is correct
162 Correct 10 ms 980 KB Output is correct
163 Correct 6 ms 980 KB Output is correct
164 Correct 14 ms 1760 KB Output is correct
165 Correct 5 ms 1760 KB Output is correct
166 Correct 13 ms 1364 KB Output is correct
167 Correct 11 ms 1108 KB Output is correct
168 Correct 11 ms 980 KB Output is correct
169 Correct 10 ms 980 KB Output is correct
170 Correct 10 ms 980 KB Output is correct
171 Correct 19 ms 1220 KB Output is correct
172 Correct 18 ms 1164 KB Output is correct
173 Correct 10 ms 1124 KB Output is correct
174 Correct 23 ms 1364 KB Output is correct
175 Correct 22 ms 2004 KB Output is correct
176 Correct 71 ms 5192 KB Output is correct
177 Correct 73 ms 5596 KB Output is correct
178 Correct 110 ms 7092 KB Output is correct
179 Correct 104 ms 8020 KB Output is correct
180 Correct 101 ms 8020 KB Output is correct
181 Correct 102 ms 8020 KB Output is correct
182 Correct 98 ms 8020 KB Output is correct
183 Correct 183 ms 9536 KB Output is correct
184 Correct 248 ms 15340 KB Output is correct
185 Correct 114 ms 8916 KB Output is correct
186 Correct 231 ms 23196 KB Output is correct
187 Correct 102 ms 11060 KB Output is correct
188 Correct 465 ms 45232 KB Output is correct
189 Correct 400 ms 15508 KB Output is correct
190 Correct 223 ms 15316 KB Output is correct
191 Correct 469 ms 47952 KB Output is correct
192 Correct 194 ms 15316 KB Output is correct
193 Correct 129 ms 15336 KB Output is correct
194 Correct 275 ms 26820 KB Output is correct
195 Correct 107 ms 26880 KB Output is correct
196 Correct 205 ms 15700 KB Output is correct
197 Correct 203 ms 15748 KB Output is correct
198 Correct 215 ms 15572 KB Output is correct
199 Correct 203 ms 15692 KB Output is correct
200 Correct 389 ms 16116 KB Output is correct
201 Correct 377 ms 15644 KB Output is correct
202 Correct 228 ms 15464 KB Output is correct
203 Correct 509 ms 30428 KB Output is correct
204 Correct 148 ms 16084 KB Output is correct
205 Correct 352 ms 18980 KB Output is correct
206 Correct 698 ms 30724 KB Output is correct
207 Correct 922 ms 80376 KB Output is correct
208 Correct 785 ms 30468 KB Output is correct
209 Correct 463 ms 30292 KB Output is correct
210 Correct 946 ms 99492 KB Output is correct
211 Correct 370 ms 30356 KB Output is correct
212 Correct 301 ms 30292 KB Output is correct
213 Correct 565 ms 53288 KB Output is correct
214 Correct 227 ms 53256 KB Output is correct
215 Correct 447 ms 30632 KB Output is correct
216 Correct 406 ms 30676 KB Output is correct
217 Correct 402 ms 31060 KB Output is correct
218 Correct 400 ms 30868 KB Output is correct
219 Correct 753 ms 45264 KB Output is correct
220 Correct 726 ms 59268 KB Output is correct
221 Correct 747 ms 76696 KB Output is correct
222 Correct 746 ms 83216 KB Output is correct
223 Correct 776 ms 37104 KB Output is correct
224 Correct 774 ms 36724 KB Output is correct
225 Correct 464 ms 36456 KB Output is correct