Submission #823839

# Submission time Handle Problem Language Result Execution time Memory
823839 2023-08-13T08:25:49 Z thimote75 Maze (JOI23_ho_t3) C++14
100 / 100
438 ms 53104 KB
#include <bits/stdc++.h>

using namespace std;

using idata = vector<int>;
using igrid = vector<idata>;
using bdata = vector<bool>;
using bgrid = vector<bdata>;

using point = pair<int, int>;

int N, M, B;
igrid visited;
bgrid isTransparent;

vector<point> adjacent (point source, bool diagonal) {
    if (diagonal) {
        return {
            { source.first - 1, source.second - 1 },
            { source.first + 1, source.second - 1 },
            { source.first - 1, source.second + 1 },
            { source.first + 1, source.second + 1 },
            { source.first,     source.second - 1 },
            { source.first,     source.second + 1 },
            { source.first - 1, source.second     },
            { source.first + 1, source.second     }
        };
    }

    return {
        { source.first,     source.second - 1 },
        { source.first,     source.second + 1 },
        { source.first - 1, source.second     },
        { source.first + 1, source.second     }
    };
}

int bfs (point source, point target) {
    deque<point> bfs_queue;
    visited[source.first][source.second] = 0;

    bfs_queue.push_front(source);

    while (bfs_queue.size() != 0) {
        point current = bfs_queue.front();
        bfs_queue.pop_front();

        bool isDiagonal = visited[current.first][current.second] % B != 0;

        for (point next : adjacent(current, isDiagonal)) {
            if (next.first  < 0 || next.first  >= N) continue ;
            if (next.second < 0 || next.second >= M) continue ;

            if (visited[next.first][next.second] != -1) continue ;

            bool plus = isDiagonal || (!isTransparent[next.first][next.second]);
            
            if (plus) {
                visited[next.first][next.second] = visited[current.first][current.second] + 1;
                bfs_queue.push_back(next);
            } else {
                visited[next.first][next.second] = visited[current.first][current.second];
                bfs_queue.push_front(next);
            }
        }
    }

    double a = visited[target.first][target.second];
    double b = B;

    return (int) ceil(a / b);
}

int main () {
    cin >> N >> M >> B;
    visited.resize(N, idata(M, - 1));

    int sx, sy;
    cin >> sx >> sy;
    sx --; sy --;
    int tx, ty;
    cin >> tx >> ty;
    tx --; ty --;

    isTransparent.resize(N, bdata(M));

    for (int i = 0; i < N; i ++) {
        string buffer;
        cin >> buffer;

        for (int j = 0; j < M; j ++)
            isTransparent[i][j] = buffer[j] == '.';
    }

    cout << bfs({ sx, sy }, { tx, ty }) << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 1 ms 300 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 300 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 0 ms 300 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 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 4 ms 624 KB Output is correct
20 Correct 3 ms 724 KB Output is correct
21 Correct 4 ms 696 KB Output is correct
22 Correct 4 ms 596 KB Output is correct
23 Correct 4 ms 564 KB Output is correct
24 Correct 3 ms 824 KB Output is correct
25 Correct 3 ms 724 KB Output is correct
26 Correct 4 ms 596 KB Output is correct
27 Correct 5 ms 596 KB Output is correct
28 Correct 4 ms 596 KB Output is correct
29 Correct 9 ms 980 KB Output is correct
30 Correct 4 ms 600 KB Output is correct
31 Correct 8 ms 1572 KB Output is correct
32 Correct 10 ms 1104 KB Output is correct
33 Correct 9 ms 1080 KB Output is correct
34 Correct 10 ms 1452 KB Output is correct
35 Correct 8 ms 1492 KB Output is correct
36 Correct 10 ms 1108 KB Output is correct
37 Correct 10 ms 1128 KB Output is correct
38 Correct 9 ms 1088 KB Output is correct
39 Correct 90 ms 7848 KB Output is correct
40 Correct 12 ms 1108 KB Output is correct
41 Correct 10 ms 1748 KB Output is correct
42 Correct 14 ms 1332 KB Output is correct
43 Correct 15 ms 1776 KB Output is correct
44 Correct 49 ms 4388 KB Output is correct
45 Correct 51 ms 4728 KB Output is correct
46 Correct 91 ms 14284 KB Output is correct
47 Correct 101 ms 7968 KB Output is correct
48 Correct 82 ms 7860 KB Output is correct
49 Correct 73 ms 11988 KB Output is correct
50 Correct 74 ms 11988 KB Output is correct
51 Correct 113 ms 8176 KB Output is correct
52 Correct 102 ms 7984 KB Output is correct
53 Correct 83 ms 7968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 280 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 1 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 1 ms 212 KB Output is correct
11 Correct 0 ms 304 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 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 296 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 300 KB Output is correct
25 Correct 1 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 1 ms 236 KB Output is correct
30 Correct 1 ms 300 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 296 KB Output is correct
8 Correct 1 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 296 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 296 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 300 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 292 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 4 ms 468 KB Output is correct
26 Correct 4 ms 696 KB Output is correct
27 Correct 5 ms 692 KB Output is correct
28 Correct 4 ms 724 KB Output is correct
29 Correct 4 ms 612 KB Output is correct
30 Correct 4 ms 596 KB Output is correct
31 Correct 4 ms 572 KB Output is correct
32 Correct 5 ms 596 KB Output is correct
33 Correct 4 ms 596 KB Output is correct
34 Correct 8 ms 1236 KB Output is correct
35 Correct 8 ms 1492 KB Output is correct
36 Correct 8 ms 1332 KB Output is correct
37 Correct 10 ms 1096 KB Output is correct
38 Correct 9 ms 1088 KB Output is correct
39 Correct 28 ms 3644 KB Output is correct
40 Correct 80 ms 9904 KB Output is correct
41 Correct 111 ms 14292 KB Output is correct
42 Correct 85 ms 9516 KB Output is correct
43 Correct 92 ms 7944 KB Output is correct
44 Correct 93 ms 8140 KB Output is correct
45 Correct 108 ms 11768 KB Output is correct
46 Correct 105 ms 11880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 280 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 1 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 1 ms 212 KB Output is correct
11 Correct 0 ms 304 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 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 296 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 300 KB Output is correct
25 Correct 1 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 1 ms 236 KB Output is correct
30 Correct 1 ms 300 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 4 ms 596 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 308 KB Output is correct
36 Correct 3 ms 468 KB Output is correct
37 Correct 3 ms 724 KB Output is correct
38 Correct 4 ms 704 KB Output is correct
39 Correct 3 ms 700 KB Output is correct
40 Correct 4 ms 596 KB Output is correct
41 Correct 4 ms 596 KB Output is correct
42 Correct 4 ms 724 KB Output is correct
43 Correct 4 ms 596 KB Output is correct
44 Correct 4 ms 596 KB Output is correct
45 Correct 4 ms 736 KB Output is correct
46 Correct 3 ms 724 KB Output is correct
47 Correct 4 ms 596 KB Output is correct
48 Correct 4 ms 596 KB Output is correct
49 Correct 5 ms 596 KB Output is correct
50 Correct 5 ms 600 KB Output is correct
51 Correct 4 ms 596 KB Output is correct
52 Correct 5 ms 596 KB Output is correct
53 Correct 4 ms 596 KB Output is correct
54 Correct 4 ms 596 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 280 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 1 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 1 ms 212 KB Output is correct
11 Correct 0 ms 304 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 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 296 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 300 KB Output is correct
25 Correct 1 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 1 ms 236 KB Output is correct
30 Correct 1 ms 300 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 4 ms 596 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 1 ms 308 KB Output is correct
36 Correct 3 ms 468 KB Output is correct
37 Correct 3 ms 724 KB Output is correct
38 Correct 4 ms 704 KB Output is correct
39 Correct 3 ms 700 KB Output is correct
40 Correct 4 ms 596 KB Output is correct
41 Correct 4 ms 596 KB Output is correct
42 Correct 4 ms 724 KB Output is correct
43 Correct 4 ms 596 KB Output is correct
44 Correct 4 ms 596 KB Output is correct
45 Correct 4 ms 736 KB Output is correct
46 Correct 3 ms 724 KB Output is correct
47 Correct 4 ms 596 KB Output is correct
48 Correct 4 ms 596 KB Output is correct
49 Correct 5 ms 596 KB Output is correct
50 Correct 5 ms 600 KB Output is correct
51 Correct 4 ms 596 KB Output is correct
52 Correct 5 ms 596 KB Output is correct
53 Correct 4 ms 596 KB Output is correct
54 Correct 4 ms 596 KB Output is correct
55 Correct 9 ms 980 KB Output is correct
56 Correct 4 ms 604 KB Output is correct
57 Correct 9 ms 1236 KB Output is correct
58 Correct 10 ms 980 KB Output is correct
59 Correct 8 ms 1492 KB Output is correct
60 Correct 11 ms 1088 KB Output is correct
61 Correct 8 ms 1096 KB Output is correct
62 Correct 8 ms 1436 KB Output is correct
63 Correct 11 ms 980 KB Output is correct
64 Correct 9 ms 1092 KB Output is correct
65 Correct 7 ms 1492 KB Output is correct
66 Correct 8 ms 1492 KB Output is correct
67 Correct 9 ms 1264 KB Output is correct
68 Correct 10 ms 952 KB Output is correct
69 Correct 10 ms 980 KB Output is correct
70 Correct 10 ms 952 KB Output is correct
71 Correct 10 ms 980 KB Output is correct
72 Correct 11 ms 1052 KB Output is correct
73 Correct 10 ms 1124 KB Output is correct
74 Correct 8 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 1 ms 300 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 300 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 0 ms 300 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 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 4 ms 624 KB Output is correct
20 Correct 3 ms 724 KB Output is correct
21 Correct 4 ms 696 KB Output is correct
22 Correct 4 ms 596 KB Output is correct
23 Correct 4 ms 564 KB Output is correct
24 Correct 3 ms 824 KB Output is correct
25 Correct 3 ms 724 KB Output is correct
26 Correct 4 ms 596 KB Output is correct
27 Correct 5 ms 596 KB Output is correct
28 Correct 4 ms 596 KB Output is correct
29 Correct 9 ms 980 KB Output is correct
30 Correct 4 ms 600 KB Output is correct
31 Correct 8 ms 1572 KB Output is correct
32 Correct 10 ms 1104 KB Output is correct
33 Correct 9 ms 1080 KB Output is correct
34 Correct 10 ms 1452 KB Output is correct
35 Correct 8 ms 1492 KB Output is correct
36 Correct 10 ms 1108 KB Output is correct
37 Correct 10 ms 1128 KB Output is correct
38 Correct 9 ms 1088 KB Output is correct
39 Correct 90 ms 7848 KB Output is correct
40 Correct 12 ms 1108 KB Output is correct
41 Correct 10 ms 1748 KB Output is correct
42 Correct 14 ms 1332 KB Output is correct
43 Correct 15 ms 1776 KB Output is correct
44 Correct 49 ms 4388 KB Output is correct
45 Correct 51 ms 4728 KB Output is correct
46 Correct 91 ms 14284 KB Output is correct
47 Correct 101 ms 7968 KB Output is correct
48 Correct 82 ms 7860 KB Output is correct
49 Correct 73 ms 11988 KB Output is correct
50 Correct 74 ms 11988 KB Output is correct
51 Correct 113 ms 8176 KB Output is correct
52 Correct 102 ms 7984 KB Output is correct
53 Correct 83 ms 7968 KB Output is correct
54 Correct 0 ms 280 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 1 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 1 ms 212 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 0 ms 304 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 0 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 0 ms 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 1 ms 212 KB Output is correct
73 Correct 0 ms 296 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 1 ms 300 KB Output is correct
78 Correct 1 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 1 ms 236 KB Output is correct
83 Correct 1 ms 300 KB Output is correct
84 Correct 1 ms 212 KB Output is correct
85 Correct 1 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 1 ms 212 KB Output is correct
91 Correct 1 ms 296 KB Output is correct
92 Correct 1 ms 296 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 0 ms 212 KB Output is correct
95 Correct 0 ms 212 KB Output is correct
96 Correct 1 ms 296 KB Output is correct
97 Correct 1 ms 212 KB Output is correct
98 Correct 1 ms 212 KB Output is correct
99 Correct 0 ms 296 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 300 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 1 ms 304 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 1 ms 212 KB Output is correct
106 Correct 1 ms 292 KB Output is correct
107 Correct 0 ms 212 KB Output is correct
108 Correct 1 ms 212 KB Output is correct
109 Correct 1 ms 212 KB Output is correct
110 Correct 4 ms 468 KB Output is correct
111 Correct 4 ms 696 KB Output is correct
112 Correct 5 ms 692 KB Output is correct
113 Correct 4 ms 724 KB Output is correct
114 Correct 4 ms 612 KB Output is correct
115 Correct 4 ms 596 KB Output is correct
116 Correct 4 ms 572 KB Output is correct
117 Correct 5 ms 596 KB Output is correct
118 Correct 4 ms 596 KB Output is correct
119 Correct 8 ms 1236 KB Output is correct
120 Correct 8 ms 1492 KB Output is correct
121 Correct 8 ms 1332 KB Output is correct
122 Correct 10 ms 1096 KB Output is correct
123 Correct 9 ms 1088 KB Output is correct
124 Correct 28 ms 3644 KB Output is correct
125 Correct 80 ms 9904 KB Output is correct
126 Correct 111 ms 14292 KB Output is correct
127 Correct 85 ms 9516 KB Output is correct
128 Correct 92 ms 7944 KB Output is correct
129 Correct 93 ms 8140 KB Output is correct
130 Correct 108 ms 11768 KB Output is correct
131 Correct 105 ms 11880 KB Output is correct
132 Correct 4 ms 596 KB Output is correct
133 Correct 1 ms 212 KB Output is correct
134 Correct 1 ms 308 KB Output is correct
135 Correct 3 ms 468 KB Output is correct
136 Correct 3 ms 724 KB Output is correct
137 Correct 4 ms 704 KB Output is correct
138 Correct 3 ms 700 KB Output is correct
139 Correct 4 ms 596 KB Output is correct
140 Correct 4 ms 596 KB Output is correct
141 Correct 4 ms 724 KB Output is correct
142 Correct 4 ms 596 KB Output is correct
143 Correct 4 ms 596 KB Output is correct
144 Correct 4 ms 736 KB Output is correct
145 Correct 3 ms 724 KB Output is correct
146 Correct 4 ms 596 KB Output is correct
147 Correct 4 ms 596 KB Output is correct
148 Correct 5 ms 596 KB Output is correct
149 Correct 5 ms 600 KB Output is correct
150 Correct 4 ms 596 KB Output is correct
151 Correct 5 ms 596 KB Output is correct
152 Correct 4 ms 596 KB Output is correct
153 Correct 4 ms 596 KB Output is correct
154 Correct 9 ms 980 KB Output is correct
155 Correct 4 ms 604 KB Output is correct
156 Correct 9 ms 1236 KB Output is correct
157 Correct 10 ms 980 KB Output is correct
158 Correct 8 ms 1492 KB Output is correct
159 Correct 11 ms 1088 KB Output is correct
160 Correct 8 ms 1096 KB Output is correct
161 Correct 8 ms 1436 KB Output is correct
162 Correct 11 ms 980 KB Output is correct
163 Correct 9 ms 1092 KB Output is correct
164 Correct 7 ms 1492 KB Output is correct
165 Correct 8 ms 1492 KB Output is correct
166 Correct 9 ms 1264 KB Output is correct
167 Correct 10 ms 952 KB Output is correct
168 Correct 10 ms 980 KB Output is correct
169 Correct 10 ms 952 KB Output is correct
170 Correct 10 ms 980 KB Output is correct
171 Correct 11 ms 1052 KB Output is correct
172 Correct 10 ms 1124 KB Output is correct
173 Correct 8 ms 980 KB Output is correct
174 Correct 14 ms 1236 KB Output is correct
175 Correct 24 ms 1992 KB Output is correct
176 Correct 59 ms 4864 KB Output is correct
177 Correct 67 ms 5472 KB Output is correct
178 Correct 100 ms 7016 KB Output is correct
179 Correct 112 ms 8000 KB Output is correct
180 Correct 95 ms 7864 KB Output is correct
181 Correct 111 ms 7852 KB Output is correct
182 Correct 97 ms 7796 KB Output is correct
183 Correct 99 ms 8388 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 1 ms 300 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 300 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 0 ms 300 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 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 4 ms 624 KB Output is correct
20 Correct 3 ms 724 KB Output is correct
21 Correct 4 ms 696 KB Output is correct
22 Correct 4 ms 596 KB Output is correct
23 Correct 4 ms 564 KB Output is correct
24 Correct 3 ms 824 KB Output is correct
25 Correct 3 ms 724 KB Output is correct
26 Correct 4 ms 596 KB Output is correct
27 Correct 5 ms 596 KB Output is correct
28 Correct 4 ms 596 KB Output is correct
29 Correct 9 ms 980 KB Output is correct
30 Correct 4 ms 600 KB Output is correct
31 Correct 8 ms 1572 KB Output is correct
32 Correct 10 ms 1104 KB Output is correct
33 Correct 9 ms 1080 KB Output is correct
34 Correct 10 ms 1452 KB Output is correct
35 Correct 8 ms 1492 KB Output is correct
36 Correct 10 ms 1108 KB Output is correct
37 Correct 10 ms 1128 KB Output is correct
38 Correct 9 ms 1088 KB Output is correct
39 Correct 90 ms 7848 KB Output is correct
40 Correct 12 ms 1108 KB Output is correct
41 Correct 10 ms 1748 KB Output is correct
42 Correct 14 ms 1332 KB Output is correct
43 Correct 15 ms 1776 KB Output is correct
44 Correct 49 ms 4388 KB Output is correct
45 Correct 51 ms 4728 KB Output is correct
46 Correct 91 ms 14284 KB Output is correct
47 Correct 101 ms 7968 KB Output is correct
48 Correct 82 ms 7860 KB Output is correct
49 Correct 73 ms 11988 KB Output is correct
50 Correct 74 ms 11988 KB Output is correct
51 Correct 113 ms 8176 KB Output is correct
52 Correct 102 ms 7984 KB Output is correct
53 Correct 83 ms 7968 KB Output is correct
54 Correct 0 ms 280 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 1 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 1 ms 212 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 0 ms 304 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 0 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 0 ms 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 1 ms 212 KB Output is correct
73 Correct 0 ms 296 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 1 ms 300 KB Output is correct
78 Correct 1 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 1 ms 236 KB Output is correct
83 Correct 1 ms 300 KB Output is correct
84 Correct 1 ms 212 KB Output is correct
85 Correct 1 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 1 ms 212 KB Output is correct
91 Correct 1 ms 296 KB Output is correct
92 Correct 1 ms 296 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 0 ms 212 KB Output is correct
95 Correct 0 ms 212 KB Output is correct
96 Correct 1 ms 296 KB Output is correct
97 Correct 1 ms 212 KB Output is correct
98 Correct 1 ms 212 KB Output is correct
99 Correct 0 ms 296 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 300 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 1 ms 304 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 1 ms 212 KB Output is correct
106 Correct 1 ms 292 KB Output is correct
107 Correct 0 ms 212 KB Output is correct
108 Correct 1 ms 212 KB Output is correct
109 Correct 1 ms 212 KB Output is correct
110 Correct 4 ms 468 KB Output is correct
111 Correct 4 ms 696 KB Output is correct
112 Correct 5 ms 692 KB Output is correct
113 Correct 4 ms 724 KB Output is correct
114 Correct 4 ms 612 KB Output is correct
115 Correct 4 ms 596 KB Output is correct
116 Correct 4 ms 572 KB Output is correct
117 Correct 5 ms 596 KB Output is correct
118 Correct 4 ms 596 KB Output is correct
119 Correct 8 ms 1236 KB Output is correct
120 Correct 8 ms 1492 KB Output is correct
121 Correct 8 ms 1332 KB Output is correct
122 Correct 10 ms 1096 KB Output is correct
123 Correct 9 ms 1088 KB Output is correct
124 Correct 28 ms 3644 KB Output is correct
125 Correct 80 ms 9904 KB Output is correct
126 Correct 111 ms 14292 KB Output is correct
127 Correct 85 ms 9516 KB Output is correct
128 Correct 92 ms 7944 KB Output is correct
129 Correct 93 ms 8140 KB Output is correct
130 Correct 108 ms 11768 KB Output is correct
131 Correct 105 ms 11880 KB Output is correct
132 Correct 4 ms 596 KB Output is correct
133 Correct 1 ms 212 KB Output is correct
134 Correct 1 ms 308 KB Output is correct
135 Correct 3 ms 468 KB Output is correct
136 Correct 3 ms 724 KB Output is correct
137 Correct 4 ms 704 KB Output is correct
138 Correct 3 ms 700 KB Output is correct
139 Correct 4 ms 596 KB Output is correct
140 Correct 4 ms 596 KB Output is correct
141 Correct 4 ms 724 KB Output is correct
142 Correct 4 ms 596 KB Output is correct
143 Correct 4 ms 596 KB Output is correct
144 Correct 4 ms 736 KB Output is correct
145 Correct 3 ms 724 KB Output is correct
146 Correct 4 ms 596 KB Output is correct
147 Correct 4 ms 596 KB Output is correct
148 Correct 5 ms 596 KB Output is correct
149 Correct 5 ms 600 KB Output is correct
150 Correct 4 ms 596 KB Output is correct
151 Correct 5 ms 596 KB Output is correct
152 Correct 4 ms 596 KB Output is correct
153 Correct 4 ms 596 KB Output is correct
154 Correct 9 ms 980 KB Output is correct
155 Correct 4 ms 604 KB Output is correct
156 Correct 9 ms 1236 KB Output is correct
157 Correct 10 ms 980 KB Output is correct
158 Correct 8 ms 1492 KB Output is correct
159 Correct 11 ms 1088 KB Output is correct
160 Correct 8 ms 1096 KB Output is correct
161 Correct 8 ms 1436 KB Output is correct
162 Correct 11 ms 980 KB Output is correct
163 Correct 9 ms 1092 KB Output is correct
164 Correct 7 ms 1492 KB Output is correct
165 Correct 8 ms 1492 KB Output is correct
166 Correct 9 ms 1264 KB Output is correct
167 Correct 10 ms 952 KB Output is correct
168 Correct 10 ms 980 KB Output is correct
169 Correct 10 ms 952 KB Output is correct
170 Correct 10 ms 980 KB Output is correct
171 Correct 11 ms 1052 KB Output is correct
172 Correct 10 ms 1124 KB Output is correct
173 Correct 8 ms 980 KB Output is correct
174 Correct 14 ms 1236 KB Output is correct
175 Correct 24 ms 1992 KB Output is correct
176 Correct 59 ms 4864 KB Output is correct
177 Correct 67 ms 5472 KB Output is correct
178 Correct 100 ms 7016 KB Output is correct
179 Correct 112 ms 8000 KB Output is correct
180 Correct 95 ms 7864 KB Output is correct
181 Correct 111 ms 7852 KB Output is correct
182 Correct 97 ms 7796 KB Output is correct
183 Correct 99 ms 8388 KB Output is correct
184 Correct 187 ms 15500 KB Output is correct
185 Correct 116 ms 8752 KB Output is correct
186 Correct 120 ms 13816 KB Output is correct
187 Correct 134 ms 11092 KB Output is correct
188 Correct 169 ms 17928 KB Output is correct
189 Correct 210 ms 15628 KB Output is correct
190 Correct 173 ms 15496 KB Output is correct
191 Correct 180 ms 17804 KB Output is correct
192 Correct 197 ms 15548 KB Output is correct
193 Correct 206 ms 15520 KB Output is correct
194 Correct 146 ms 23764 KB Output is correct
195 Correct 150 ms 23828 KB Output is correct
196 Correct 196 ms 15596 KB Output is correct
197 Correct 217 ms 15556 KB Output is correct
198 Correct 187 ms 15392 KB Output is correct
199 Correct 186 ms 15372 KB Output is correct
200 Correct 203 ms 15844 KB Output is correct
201 Correct 212 ms 15684 KB Output is correct
202 Correct 199 ms 15508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 212 KB Output is correct
6 Correct 1 ms 300 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 300 KB Output is correct
11 Correct 1 ms 304 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 0 ms 300 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 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 4 ms 624 KB Output is correct
20 Correct 3 ms 724 KB Output is correct
21 Correct 4 ms 696 KB Output is correct
22 Correct 4 ms 596 KB Output is correct
23 Correct 4 ms 564 KB Output is correct
24 Correct 3 ms 824 KB Output is correct
25 Correct 3 ms 724 KB Output is correct
26 Correct 4 ms 596 KB Output is correct
27 Correct 5 ms 596 KB Output is correct
28 Correct 4 ms 596 KB Output is correct
29 Correct 9 ms 980 KB Output is correct
30 Correct 4 ms 600 KB Output is correct
31 Correct 8 ms 1572 KB Output is correct
32 Correct 10 ms 1104 KB Output is correct
33 Correct 9 ms 1080 KB Output is correct
34 Correct 10 ms 1452 KB Output is correct
35 Correct 8 ms 1492 KB Output is correct
36 Correct 10 ms 1108 KB Output is correct
37 Correct 10 ms 1128 KB Output is correct
38 Correct 9 ms 1088 KB Output is correct
39 Correct 90 ms 7848 KB Output is correct
40 Correct 12 ms 1108 KB Output is correct
41 Correct 10 ms 1748 KB Output is correct
42 Correct 14 ms 1332 KB Output is correct
43 Correct 15 ms 1776 KB Output is correct
44 Correct 49 ms 4388 KB Output is correct
45 Correct 51 ms 4728 KB Output is correct
46 Correct 91 ms 14284 KB Output is correct
47 Correct 101 ms 7968 KB Output is correct
48 Correct 82 ms 7860 KB Output is correct
49 Correct 73 ms 11988 KB Output is correct
50 Correct 74 ms 11988 KB Output is correct
51 Correct 113 ms 8176 KB Output is correct
52 Correct 102 ms 7984 KB Output is correct
53 Correct 83 ms 7968 KB Output is correct
54 Correct 0 ms 280 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 1 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 1 ms 212 KB Output is correct
62 Correct 1 ms 212 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 0 ms 304 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 0 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 0 ms 212 KB Output is correct
71 Correct 0 ms 212 KB Output is correct
72 Correct 1 ms 212 KB Output is correct
73 Correct 0 ms 296 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 1 ms 300 KB Output is correct
78 Correct 1 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 1 ms 236 KB Output is correct
83 Correct 1 ms 300 KB Output is correct
84 Correct 1 ms 212 KB Output is correct
85 Correct 1 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 1 ms 212 KB Output is correct
91 Correct 1 ms 296 KB Output is correct
92 Correct 1 ms 296 KB Output is correct
93 Correct 1 ms 212 KB Output is correct
94 Correct 0 ms 212 KB Output is correct
95 Correct 0 ms 212 KB Output is correct
96 Correct 1 ms 296 KB Output is correct
97 Correct 1 ms 212 KB Output is correct
98 Correct 1 ms 212 KB Output is correct
99 Correct 0 ms 296 KB Output is correct
100 Correct 0 ms 212 KB Output is correct
101 Correct 1 ms 300 KB Output is correct
102 Correct 0 ms 212 KB Output is correct
103 Correct 1 ms 304 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 1 ms 212 KB Output is correct
106 Correct 1 ms 292 KB Output is correct
107 Correct 0 ms 212 KB Output is correct
108 Correct 1 ms 212 KB Output is correct
109 Correct 1 ms 212 KB Output is correct
110 Correct 4 ms 468 KB Output is correct
111 Correct 4 ms 696 KB Output is correct
112 Correct 5 ms 692 KB Output is correct
113 Correct 4 ms 724 KB Output is correct
114 Correct 4 ms 612 KB Output is correct
115 Correct 4 ms 596 KB Output is correct
116 Correct 4 ms 572 KB Output is correct
117 Correct 5 ms 596 KB Output is correct
118 Correct 4 ms 596 KB Output is correct
119 Correct 8 ms 1236 KB Output is correct
120 Correct 8 ms 1492 KB Output is correct
121 Correct 8 ms 1332 KB Output is correct
122 Correct 10 ms 1096 KB Output is correct
123 Correct 9 ms 1088 KB Output is correct
124 Correct 28 ms 3644 KB Output is correct
125 Correct 80 ms 9904 KB Output is correct
126 Correct 111 ms 14292 KB Output is correct
127 Correct 85 ms 9516 KB Output is correct
128 Correct 92 ms 7944 KB Output is correct
129 Correct 93 ms 8140 KB Output is correct
130 Correct 108 ms 11768 KB Output is correct
131 Correct 105 ms 11880 KB Output is correct
132 Correct 4 ms 596 KB Output is correct
133 Correct 1 ms 212 KB Output is correct
134 Correct 1 ms 308 KB Output is correct
135 Correct 3 ms 468 KB Output is correct
136 Correct 3 ms 724 KB Output is correct
137 Correct 4 ms 704 KB Output is correct
138 Correct 3 ms 700 KB Output is correct
139 Correct 4 ms 596 KB Output is correct
140 Correct 4 ms 596 KB Output is correct
141 Correct 4 ms 724 KB Output is correct
142 Correct 4 ms 596 KB Output is correct
143 Correct 4 ms 596 KB Output is correct
144 Correct 4 ms 736 KB Output is correct
145 Correct 3 ms 724 KB Output is correct
146 Correct 4 ms 596 KB Output is correct
147 Correct 4 ms 596 KB Output is correct
148 Correct 5 ms 596 KB Output is correct
149 Correct 5 ms 600 KB Output is correct
150 Correct 4 ms 596 KB Output is correct
151 Correct 5 ms 596 KB Output is correct
152 Correct 4 ms 596 KB Output is correct
153 Correct 4 ms 596 KB Output is correct
154 Correct 9 ms 980 KB Output is correct
155 Correct 4 ms 604 KB Output is correct
156 Correct 9 ms 1236 KB Output is correct
157 Correct 10 ms 980 KB Output is correct
158 Correct 8 ms 1492 KB Output is correct
159 Correct 11 ms 1088 KB Output is correct
160 Correct 8 ms 1096 KB Output is correct
161 Correct 8 ms 1436 KB Output is correct
162 Correct 11 ms 980 KB Output is correct
163 Correct 9 ms 1092 KB Output is correct
164 Correct 7 ms 1492 KB Output is correct
165 Correct 8 ms 1492 KB Output is correct
166 Correct 9 ms 1264 KB Output is correct
167 Correct 10 ms 952 KB Output is correct
168 Correct 10 ms 980 KB Output is correct
169 Correct 10 ms 952 KB Output is correct
170 Correct 10 ms 980 KB Output is correct
171 Correct 11 ms 1052 KB Output is correct
172 Correct 10 ms 1124 KB Output is correct
173 Correct 8 ms 980 KB Output is correct
174 Correct 14 ms 1236 KB Output is correct
175 Correct 24 ms 1992 KB Output is correct
176 Correct 59 ms 4864 KB Output is correct
177 Correct 67 ms 5472 KB Output is correct
178 Correct 100 ms 7016 KB Output is correct
179 Correct 112 ms 8000 KB Output is correct
180 Correct 95 ms 7864 KB Output is correct
181 Correct 111 ms 7852 KB Output is correct
182 Correct 97 ms 7796 KB Output is correct
183 Correct 99 ms 8388 KB Output is correct
184 Correct 187 ms 15500 KB Output is correct
185 Correct 116 ms 8752 KB Output is correct
186 Correct 120 ms 13816 KB Output is correct
187 Correct 134 ms 11092 KB Output is correct
188 Correct 169 ms 17928 KB Output is correct
189 Correct 210 ms 15628 KB Output is correct
190 Correct 173 ms 15496 KB Output is correct
191 Correct 180 ms 17804 KB Output is correct
192 Correct 197 ms 15548 KB Output is correct
193 Correct 206 ms 15520 KB Output is correct
194 Correct 146 ms 23764 KB Output is correct
195 Correct 150 ms 23828 KB Output is correct
196 Correct 196 ms 15596 KB Output is correct
197 Correct 217 ms 15556 KB Output is correct
198 Correct 187 ms 15392 KB Output is correct
199 Correct 186 ms 15372 KB Output is correct
200 Correct 203 ms 15844 KB Output is correct
201 Correct 212 ms 15684 KB Output is correct
202 Correct 199 ms 15508 KB Output is correct
203 Correct 381 ms 30580 KB Output is correct
204 Correct 198 ms 15904 KB Output is correct
205 Correct 261 ms 18752 KB Output is correct
206 Correct 391 ms 30612 KB Output is correct
207 Correct 403 ms 53104 KB Output is correct
208 Correct 419 ms 30648 KB Output is correct
209 Correct 403 ms 30588 KB Output is correct
210 Correct 412 ms 34040 KB Output is correct
211 Correct 372 ms 30716 KB Output is correct
212 Correct 401 ms 30756 KB Output is correct
213 Correct 298 ms 47228 KB Output is correct
214 Correct 295 ms 47292 KB Output is correct
215 Correct 410 ms 30848 KB Output is correct
216 Correct 405 ms 30776 KB Output is correct
217 Correct 432 ms 30944 KB Output is correct
218 Correct 423 ms 30452 KB Output is correct
219 Correct 438 ms 35908 KB Output is correct
220 Correct 403 ms 40680 KB Output is correct
221 Correct 436 ms 46940 KB Output is correct
222 Correct 429 ms 47104 KB Output is correct
223 Correct 416 ms 31044 KB Output is correct
224 Correct 416 ms 30924 KB Output is correct
225 Correct 389 ms 30652 KB Output is correct