Submission #1036520

# Submission time Handle Problem Language Result Execution time Memory
1036520 2024-07-27T13:29:00 Z model_code Toy (CEOI24_toy) C++17
100 / 100
236 ms 5572 KB
// Author: Ondra Sladký
// Alternative optimal solution which is based in the ideas in the (broken) solutions
// coloring edges and vertices.
// It colors edges through which individual rectangles can move. It also colors edges inside
// the rectangles for each position of the rectangle (which is why it works) which is for simplicity
// done using edge coloring of rectangles of size k-1 and l-1.
// It runs in O(wh)
// It should solve every subtask.

#include <bits/stdc++.h>
using namespace std;
#define f(i, a, b) for (int i = (a); i < (b); i++)

#define v vector

int w, h, k, l;
int xhI, yhI, xvI, yvI;
int xt, yt;
v<v<bool>> grid;

v<v<bool>> validH;
v<v<bool>> validV;

v<v<bool>> statesH;
v<v<v<bool>>> stateHedges;
v<v<bool>> statesV;
v<v<v<bool>>> stateVedges;
v<v<bool>> states;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    cin >> w >> h >> k >> l;
    cin >> xhI >> yhI >> xvI >> yvI;
    grid = v<v<bool>>(w, v<bool>(h));
    f(i, 0, h) {
        string s;
        cin >> s;
        f(j, 0, w) {
            char x = s[j];
            grid[j][i] = x == 'X';
            if (x == '*') {
                xt = j;
                yt = i;
            }
        }
    }

    // Precompute valid positions for horizontal and vertical blocks.
    validH = v<v<bool>>(w, v<bool>(h, false));
    validV = v<v<bool>>(w, v<bool>(h, false));

    f(i,0,h) {
        int last = -1;
        f(j,0,w) {
            if (grid[j][i]) {
                last = j;
            }
            int start = j - k + 1;
            if (start > last) {
                validH[start][i] = true;
            }
        }
    }

    f(i,0,w) {
        int last = -1;
        f(j,0,h) {
            if (grid[i][j]) {
                last = j;
            }
            int start = j - l + 1;
            if (start > last) {
                validV[i][start] = true;
            }
        }
    }


    auto directions = v<tuple<int, int>> {
        {1, 0},
        {-1, 0},
        {0, 1},
        {0, -1},
    };
    queue<tuple<int, int>> q;
    q.push({xhI, yhI});
    statesH = v<v<bool>>(w, v<bool>(h, false));
    stateHedges = v<v<v<bool>>>(4, v<v<bool>>(w, v<bool>(h, false)));
    statesH[xhI][yhI] = true;
    while (!q.empty()) {
        auto [xh, yh] = q.front();
        q.pop();
        f(index, 0, 4) {
            auto [dx, dy] = directions[index];
            int nxh = xh + dx;
            int nyh = yh + dy;

            // Fast check for obstacles

            bool blocked = false;
            if (nxh < 0 || nxh >= w || nyh < 0 || nyh >= h) blocked = true;
            if (blocked) continue;
            if (!validH[nxh][nyh]) blocked = true;
            if (blocked) continue;

            stateHedges[index][xh][yh] = true;

            if (statesH[nxh][nyh]) continue;
            statesH[nxh][nyh] = true;
            q.push({nxh, nyh});
        }
    }
    // Edge coloring.
    f(d,0,4) {
        f(i,0,h) {
            int last = -k;
            f(j,0,w) {
                if (stateHedges[d][j][i]) {
                    last = j;
                }
                stateHedges[d][j][i] = j - k < last;
            }
        }
    }
    // Vertex coloring with k-1.
    f(i,0,h) {
        int last = -k;
        f(j,0,w) {
            if (statesH[j][i]) {
                last = j;
            }
            statesH[j][i] = j - k + 1 < last;
        }
    }

    q.push({xvI, yvI});
    statesV = v<v<bool>>(w, v<bool>(h, false));
    stateVedges = v<v<v<bool>>>(4, v<v<bool>>(w, v<bool>(h, false)));
    statesV[xvI][yvI] = true;
    while (!q.empty()) {
        auto [xv, yv] = q.front();
        q.pop();
        f(index, 0, 4) {
            auto [dx, dy] = directions[index];
            int nxv = xv + dx;
            int nyv = yv + dy;

            // Fast check for obstacles

            bool blocked = false;
            if (nxv < 0 || nxv >= w || nyv < 0 || nyv >= h) blocked = true;
            if (blocked) continue;
            if (!validV[nxv][nyv]) blocked = true;
            if (blocked) continue;

            stateVedges[index][xv][yv] = true;

            if (statesV[nxv][nyv]) continue;
            statesV[nxv][nyv] = true;
            q.push({nxv, nyv});
        }
    }
    // Edge coloring.
    f(d,0,4){
        f(i,0,w) {
            int last = -l;
            f(j,0,h) {
                if (stateVedges[d][i][j]) {
                    last = j;
                }
                stateVedges[d][i][j] = j - l < last;
            }
        }
    }
    // Vertex coloring with l-1.
    f(i,0,w) {
        int last = -l;
        f(j,0,h) {
            if (statesV[i][j]) {
                last = j;
            }
            statesV[i][j] = j - l + 1 < last;
        }
    }

    // Find a path from (xvI, yhI) to (xt, yt) that is edge-colored by both rectangles.

    q.push({xvI, yhI});
    states = v<v<bool>>(w, v<bool>(h, false));
    states[xvI][yhI] = true;
    while(!q.empty()) {
        auto [xv, yv] = q.front();
        q.pop();
        f(index, 0, 4) {
            auto [dx, dy] = directions[index];
            int nxv = xv + dx;
            int nyv = yv + dy;
            if (nxv < 0 || nxv >= w || nyv < 0 || nyv >= h) continue;
            bool Hgood = stateHedges[index][xv][yv];
            if (dx != 0) {
                if (statesH[min(xv, nxv)][yv]) Hgood = true;
            }
            bool Vgood = stateVedges[index][xv][yv];
            if (dy != 0) {
                if (statesV[xv][min(yv, nyv)]) Vgood = true;
            }
            if (!Hgood || !Vgood) continue;
            if (states[nxv][nyv]) continue;
            states[nxv][nyv] = true;
            q.push({nxv, nyv});
        }
    }


    bool reached = states[xt][yt];

    cout << (reached ? "YES" : "NO") << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 484 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 484 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 1 ms 420 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 2 ms 348 KB Output is correct
64 Correct 2 ms 348 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 2 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 2 ms 348 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 1 ms 348 KB Output is correct
74 Correct 1 ms 344 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 ms 544 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 2 ms 508 KB Output is correct
79 Correct 1 ms 348 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 1 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 1 ms 344 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 1 ms 348 KB Output is correct
90 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 10 ms 816 KB Output is correct
5 Correct 9 ms 604 KB Output is correct
6 Correct 1 ms 620 KB Output is correct
7 Correct 13 ms 604 KB Output is correct
8 Correct 9 ms 824 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 4 ms 604 KB Output is correct
11 Correct 3 ms 604 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 3 ms 604 KB Output is correct
14 Correct 3 ms 604 KB Output is correct
15 Correct 11 ms 600 KB Output is correct
16 Correct 7 ms 600 KB Output is correct
17 Correct 10 ms 792 KB Output is correct
18 Correct 8 ms 608 KB Output is correct
19 Correct 9 ms 600 KB Output is correct
20 Correct 9 ms 600 KB Output is correct
21 Correct 9 ms 612 KB Output is correct
22 Correct 9 ms 612 KB Output is correct
23 Correct 11 ms 612 KB Output is correct
24 Correct 8 ms 604 KB Output is correct
25 Correct 8 ms 832 KB Output is correct
26 Correct 8 ms 832 KB Output is correct
27 Correct 8 ms 604 KB Output is correct
28 Correct 8 ms 604 KB Output is correct
29 Correct 8 ms 600 KB Output is correct
30 Correct 9 ms 604 KB Output is correct
31 Correct 13 ms 600 KB Output is correct
32 Correct 8 ms 604 KB Output is correct
33 Correct 7 ms 604 KB Output is correct
34 Correct 8 ms 688 KB Output is correct
35 Correct 11 ms 604 KB Output is correct
36 Correct 3 ms 604 KB Output is correct
37 Correct 10 ms 604 KB Output is correct
38 Correct 6 ms 604 KB Output is correct
39 Correct 6 ms 684 KB Output is correct
40 Correct 9 ms 600 KB Output is correct
41 Correct 6 ms 604 KB Output is correct
42 Correct 8 ms 828 KB Output is correct
43 Correct 8 ms 824 KB Output is correct
44 Correct 8 ms 828 KB Output is correct
45 Correct 8 ms 604 KB Output is correct
46 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 484 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 1 ms 420 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 2 ms 348 KB Output is correct
64 Correct 2 ms 348 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 2 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 2 ms 348 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 1 ms 348 KB Output is correct
74 Correct 1 ms 344 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 ms 544 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 2 ms 508 KB Output is correct
79 Correct 1 ms 348 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 1 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 1 ms 344 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 1 ms 348 KB Output is correct
90 Correct 1 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 10 ms 816 KB Output is correct
93 Correct 9 ms 604 KB Output is correct
94 Correct 1 ms 620 KB Output is correct
95 Correct 13 ms 604 KB Output is correct
96 Correct 9 ms 824 KB Output is correct
97 Correct 2 ms 604 KB Output is correct
98 Correct 4 ms 604 KB Output is correct
99 Correct 3 ms 604 KB Output is correct
100 Correct 1 ms 348 KB Output is correct
101 Correct 3 ms 604 KB Output is correct
102 Correct 3 ms 604 KB Output is correct
103 Correct 11 ms 600 KB Output is correct
104 Correct 7 ms 600 KB Output is correct
105 Correct 10 ms 792 KB Output is correct
106 Correct 8 ms 608 KB Output is correct
107 Correct 9 ms 600 KB Output is correct
108 Correct 9 ms 600 KB Output is correct
109 Correct 9 ms 612 KB Output is correct
110 Correct 9 ms 612 KB Output is correct
111 Correct 11 ms 612 KB Output is correct
112 Correct 8 ms 604 KB Output is correct
113 Correct 8 ms 832 KB Output is correct
114 Correct 8 ms 832 KB Output is correct
115 Correct 8 ms 604 KB Output is correct
116 Correct 8 ms 604 KB Output is correct
117 Correct 8 ms 600 KB Output is correct
118 Correct 9 ms 604 KB Output is correct
119 Correct 13 ms 600 KB Output is correct
120 Correct 8 ms 604 KB Output is correct
121 Correct 7 ms 604 KB Output is correct
122 Correct 8 ms 688 KB Output is correct
123 Correct 11 ms 604 KB Output is correct
124 Correct 3 ms 604 KB Output is correct
125 Correct 10 ms 604 KB Output is correct
126 Correct 6 ms 604 KB Output is correct
127 Correct 6 ms 684 KB Output is correct
128 Correct 9 ms 600 KB Output is correct
129 Correct 6 ms 604 KB Output is correct
130 Correct 8 ms 828 KB Output is correct
131 Correct 8 ms 824 KB Output is correct
132 Correct 8 ms 828 KB Output is correct
133 Correct 8 ms 604 KB Output is correct
134 Correct 2 ms 604 KB Output is correct
135 Correct 2 ms 604 KB Output is correct
136 Correct 6 ms 972 KB Output is correct
137 Correct 4 ms 860 KB Output is correct
138 Correct 3 ms 604 KB Output is correct
139 Correct 4 ms 860 KB Output is correct
140 Correct 4 ms 792 KB Output is correct
141 Correct 1 ms 604 KB Output is correct
142 Correct 4 ms 924 KB Output is correct
143 Correct 4 ms 860 KB Output is correct
144 Correct 1 ms 604 KB Output is correct
145 Correct 4 ms 860 KB Output is correct
146 Correct 4 ms 788 KB Output is correct
147 Correct 8 ms 860 KB Output is correct
148 Correct 9 ms 792 KB Output is correct
149 Correct 8 ms 860 KB Output is correct
150 Correct 10 ms 792 KB Output is correct
151 Correct 10 ms 860 KB Output is correct
152 Correct 10 ms 980 KB Output is correct
153 Correct 10 ms 860 KB Output is correct
154 Correct 9 ms 860 KB Output is correct
155 Correct 10 ms 980 KB Output is correct
156 Correct 11 ms 860 KB Output is correct
157 Correct 10 ms 860 KB Output is correct
158 Correct 12 ms 976 KB Output is correct
159 Correct 10 ms 860 KB Output is correct
160 Correct 13 ms 860 KB Output is correct
161 Correct 10 ms 792 KB Output is correct
162 Correct 11 ms 780 KB Output is correct
163 Correct 11 ms 860 KB Output is correct
164 Correct 12 ms 860 KB Output is correct
165 Correct 11 ms 860 KB Output is correct
166 Correct 12 ms 784 KB Output is correct
167 Correct 11 ms 856 KB Output is correct
168 Correct 4 ms 860 KB Output is correct
169 Correct 7 ms 956 KB Output is correct
170 Correct 8 ms 860 KB Output is correct
171 Correct 8 ms 860 KB Output is correct
172 Correct 7 ms 764 KB Output is correct
173 Correct 8 ms 856 KB Output is correct
174 Correct 7 ms 856 KB Output is correct
175 Correct 7 ms 860 KB Output is correct
176 Correct 7 ms 860 KB Output is correct
177 Correct 7 ms 860 KB Output is correct
178 Correct 3 ms 820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 468 KB Output is correct
21 Correct 1 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 484 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 1 ms 348 KB Output is correct
39 Correct 1 ms 344 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 0 ms 348 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 1 ms 348 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 1 ms 348 KB Output is correct
60 Correct 1 ms 348 KB Output is correct
61 Correct 1 ms 420 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 2 ms 348 KB Output is correct
64 Correct 2 ms 348 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 2 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 2 ms 348 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 1 ms 348 KB Output is correct
74 Correct 1 ms 344 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 ms 544 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 2 ms 508 KB Output is correct
79 Correct 1 ms 348 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 1 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 1 ms 344 KB Output is correct
88 Correct 1 ms 348 KB Output is correct
89 Correct 1 ms 348 KB Output is correct
90 Correct 1 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 10 ms 816 KB Output is correct
93 Correct 9 ms 604 KB Output is correct
94 Correct 1 ms 620 KB Output is correct
95 Correct 13 ms 604 KB Output is correct
96 Correct 9 ms 824 KB Output is correct
97 Correct 2 ms 604 KB Output is correct
98 Correct 4 ms 604 KB Output is correct
99 Correct 3 ms 604 KB Output is correct
100 Correct 1 ms 348 KB Output is correct
101 Correct 3 ms 604 KB Output is correct
102 Correct 3 ms 604 KB Output is correct
103 Correct 11 ms 600 KB Output is correct
104 Correct 7 ms 600 KB Output is correct
105 Correct 10 ms 792 KB Output is correct
106 Correct 8 ms 608 KB Output is correct
107 Correct 9 ms 600 KB Output is correct
108 Correct 9 ms 600 KB Output is correct
109 Correct 9 ms 612 KB Output is correct
110 Correct 9 ms 612 KB Output is correct
111 Correct 11 ms 612 KB Output is correct
112 Correct 8 ms 604 KB Output is correct
113 Correct 8 ms 832 KB Output is correct
114 Correct 8 ms 832 KB Output is correct
115 Correct 8 ms 604 KB Output is correct
116 Correct 8 ms 604 KB Output is correct
117 Correct 8 ms 600 KB Output is correct
118 Correct 9 ms 604 KB Output is correct
119 Correct 13 ms 600 KB Output is correct
120 Correct 8 ms 604 KB Output is correct
121 Correct 7 ms 604 KB Output is correct
122 Correct 8 ms 688 KB Output is correct
123 Correct 11 ms 604 KB Output is correct
124 Correct 3 ms 604 KB Output is correct
125 Correct 10 ms 604 KB Output is correct
126 Correct 6 ms 604 KB Output is correct
127 Correct 6 ms 684 KB Output is correct
128 Correct 9 ms 600 KB Output is correct
129 Correct 6 ms 604 KB Output is correct
130 Correct 8 ms 828 KB Output is correct
131 Correct 8 ms 824 KB Output is correct
132 Correct 8 ms 828 KB Output is correct
133 Correct 8 ms 604 KB Output is correct
134 Correct 2 ms 604 KB Output is correct
135 Correct 2 ms 604 KB Output is correct
136 Correct 6 ms 972 KB Output is correct
137 Correct 4 ms 860 KB Output is correct
138 Correct 3 ms 604 KB Output is correct
139 Correct 4 ms 860 KB Output is correct
140 Correct 4 ms 792 KB Output is correct
141 Correct 1 ms 604 KB Output is correct
142 Correct 4 ms 924 KB Output is correct
143 Correct 4 ms 860 KB Output is correct
144 Correct 1 ms 604 KB Output is correct
145 Correct 4 ms 860 KB Output is correct
146 Correct 4 ms 788 KB Output is correct
147 Correct 8 ms 860 KB Output is correct
148 Correct 9 ms 792 KB Output is correct
149 Correct 8 ms 860 KB Output is correct
150 Correct 10 ms 792 KB Output is correct
151 Correct 10 ms 860 KB Output is correct
152 Correct 10 ms 980 KB Output is correct
153 Correct 10 ms 860 KB Output is correct
154 Correct 9 ms 860 KB Output is correct
155 Correct 10 ms 980 KB Output is correct
156 Correct 11 ms 860 KB Output is correct
157 Correct 10 ms 860 KB Output is correct
158 Correct 12 ms 976 KB Output is correct
159 Correct 10 ms 860 KB Output is correct
160 Correct 13 ms 860 KB Output is correct
161 Correct 10 ms 792 KB Output is correct
162 Correct 11 ms 780 KB Output is correct
163 Correct 11 ms 860 KB Output is correct
164 Correct 12 ms 860 KB Output is correct
165 Correct 11 ms 860 KB Output is correct
166 Correct 12 ms 784 KB Output is correct
167 Correct 11 ms 856 KB Output is correct
168 Correct 4 ms 860 KB Output is correct
169 Correct 7 ms 956 KB Output is correct
170 Correct 8 ms 860 KB Output is correct
171 Correct 8 ms 860 KB Output is correct
172 Correct 7 ms 764 KB Output is correct
173 Correct 8 ms 856 KB Output is correct
174 Correct 7 ms 856 KB Output is correct
175 Correct 7 ms 860 KB Output is correct
176 Correct 7 ms 860 KB Output is correct
177 Correct 7 ms 860 KB Output is correct
178 Correct 3 ms 820 KB Output is correct
179 Correct 29 ms 1880 KB Output is correct
180 Correct 56 ms 5552 KB Output is correct
181 Correct 54 ms 5460 KB Output is correct
182 Correct 17 ms 1880 KB Output is correct
183 Correct 55 ms 5412 KB Output is correct
184 Correct 55 ms 5456 KB Output is correct
185 Correct 41 ms 3920 KB Output is correct
186 Correct 55 ms 5416 KB Output is correct
187 Correct 55 ms 5560 KB Output is correct
188 Correct 32 ms 3160 KB Output is correct
189 Correct 63 ms 5560 KB Output is correct
190 Correct 62 ms 5460 KB Output is correct
191 Correct 136 ms 4944 KB Output is correct
192 Correct 172 ms 5200 KB Output is correct
193 Correct 158 ms 4984 KB Output is correct
194 Correct 197 ms 5556 KB Output is correct
195 Correct 185 ms 5456 KB Output is correct
196 Correct 187 ms 5460 KB Output is correct
197 Correct 174 ms 5456 KB Output is correct
198 Correct 185 ms 5548 KB Output is correct
199 Correct 177 ms 5456 KB Output is correct
200 Correct 226 ms 5532 KB Output is correct
201 Correct 198 ms 5456 KB Output is correct
202 Correct 193 ms 5460 KB Output is correct
203 Correct 231 ms 5456 KB Output is correct
204 Correct 194 ms 5464 KB Output is correct
205 Correct 191 ms 5536 KB Output is correct
206 Correct 236 ms 4688 KB Output is correct
207 Correct 197 ms 4924 KB Output is correct
208 Correct 211 ms 4784 KB Output is correct
209 Correct 214 ms 4688 KB Output is correct
210 Correct 212 ms 4908 KB Output is correct
211 Correct 233 ms 4948 KB Output is correct
212 Correct 63 ms 4952 KB Output is correct
213 Correct 133 ms 5200 KB Output is correct
214 Correct 125 ms 4948 KB Output is correct
215 Correct 144 ms 5060 KB Output is correct
216 Correct 123 ms 4692 KB Output is correct
217 Correct 131 ms 4692 KB Output is correct
218 Correct 139 ms 5572 KB Output is correct
219 Correct 132 ms 5460 KB Output is correct
220 Correct 138 ms 5456 KB Output is correct
221 Correct 166 ms 5412 KB Output is correct
222 Correct 47 ms 4760 KB Output is correct