Submission #1070554

# Submission time Handle Problem Language Result Execution time Memory
1070554 2024-08-22T15:18:38 Z faruk Toy (CEOI24_toy) C++17
100 / 100
119 ms 56448 KB
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define mp make_pair

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

vector<string> grid;
vector<vector<int> > max_up, max_right, can_hori, can_vert, box_hori, box_vert;
int n, m;

bool check_box_hori(int i, int j1, int j2) {
    j1 = max(j1, 0);
    j2 = min(j2, m - 1);
    if (j1 > j2)
        return 0;
    int v1 = box_hori[i][j1];
    if (j2 != m - 1)
        v1 -= box_hori[i][j2 + 1];
    return v1 > 0;
}

bool check_box_vert(int i1, int i2, int j) {
    i1 = max(i1, 0);
    i2 = min(i2, n - 1);
    if (i1 > i2)
        return 0;
    int v2 = box_vert[i2][j];
    if (i1 != 0)
        v2 -= box_vert[i1 - 1][j];
    return v2;
}

int get_num_ok_hori(int i, int j1, int j2) {
    j1 = max(j1, 0);
    j2 = min(j2, m - 1);
    if (j1 > j2)
        return 0;
    int v1 = can_hori[i][j1];
    if (j2 != m - 1)
        v1 -= can_hori[i][j2 + 1];
    return v1;
}

int get_num_ok_vert(int i1, int i2, int j) {
    i1 = max(i1, 0);
    i2 = min(i2, n - 1);
    if (i1 > i2)
        return 0;
    int v2 = can_vert[i2][j];
    if (i1 != 0)
        v2 -= can_vert[i1 - 1][j];
    return v2;
}

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

    int w, h;
    cin >> m >> n >> w >> h;
    int x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    pii strt(y1, x2);

    pii endd;
    grid = vector<string>(n);
    for (int i = 0; i < n; i++)
        cin >> grid[i];
    max_up = max_right = can_hori = can_vert = box_hori = box_vert = vector<vector<int> > (n + 1, vector<int>(m + 1));
    for (int i = 0; i < n; i++) {
        for (int j = m - 1; j >= 0; j--) {
            if (grid[i][j] == '*')
                endd = pii(i, j);
            if (grid[i][j] == '.' || grid[i][j] == '*')
                max_up[i][j] = max_right[i][j] = 1;
            if (i != 0 and max_up[i][j] != 0)
                max_up[i][j] += max_up[i - 1][j];
            if (j != m - 1 and max_up[i][j] != 0)
                max_right[i][j] += max_right[i][j + 1];
            
            if (max_up[i][j] >= h)
                can_vert[i][j] = 1;
            if (max_right[i][j] >= w)
                can_hori[i][j] = 1;

            if (j != m - 1)
                if (can_vert[i][j] and can_vert[i][j + 1])
                    box_vert[i][j] = 1;
            if (i != 0)
                if (can_hori[i - 1][j] and can_hori[i][j])
                    box_hori[i][j] = 1;
        }
    }

    for (int i = 0; i < n; i++) {
        for (int j = m - 1; j >= 0; j--) {
            if (j != m - 1)
                box_hori[i][j] += box_hori[i][j + 1], can_hori[i][j] += can_hori[i][j + 1];
            if (i != 0)
                box_vert[i][j] += box_vert[i - 1][j], can_vert[i][j] += can_vert[i - 1][j];
        }
    }

    vector<vector<bool> > vis(n, vector<bool> (m));
    vis[strt.first][strt.second] = true;

    queue<pii> qu;
    qu.push(strt);
    while (!qu.empty()) {
        pii curr = qu.front(); qu.pop();

        // try moving vert to front
        int i1 = curr.first, i2 = curr.first + h - 1;
        if (curr.second != m - 1 and !vis[curr.first][curr.second + 1] and check_box_vert(i1, i2, curr.second))
        {
            // add anoterh
            if (get_num_ok_hori(curr.first, curr.second - (w - 2), curr.second) > 0) {
                vis[curr.first][curr.second + 1] = true;
                qu.push(pii(curr.first, curr.second + 1));
            }
        }
        // try moving back
        if (curr.second != 0 and !vis[curr.first][curr.second - 1] and check_box_vert(i1, i2, curr.second - 1))
        {
            // add anotehr
            if (get_num_ok_hori(curr.first, curr.second - (w - 1), curr.second - 1) > 0) {
                vis[curr.first][curr.second - 1] = true;
                qu.push(pii(curr.first, curr.second - 1));
            }
        }

        // try moving hori up
        int j1 = curr.second - w + 1, j2 = curr.second;
        if (curr.first != 0 and !vis[curr.first - 1][curr.second] and check_box_hori(curr.first, j1, j2)) {
            if (get_num_ok_vert(curr.first, curr.first + (h - 2), curr.second) > 0) {
                vis[curr.first - 1][curr.second] = true;
                qu.push(pii(curr.first - 1, curr.second));
            }
        }

        // try moving hori down
        if (curr.first != n - 1 and !vis[curr.first + 1][curr.second] and check_box_hori(curr.first + 1, j1, j2)) {
            if (get_num_ok_vert(curr.first + 1, curr.first + (h - 1), curr.second) > 0) {
                vis[curr.first + 1][curr.second] = true;
                qu.push(pii(curr.first + 1, curr.second));
            }
        }
    }

    
    if (vis[endd.first][endd.second])   
        cout << "YES\n";
    else
        cout << "NO\n";
}
# 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 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 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 1 ms 600 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 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 416 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 400 KB Output is correct
39 Correct 0 ms 344 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 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 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 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 1 ms 600 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 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 416 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 400 KB Output is correct
39 Correct 0 ms 344 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 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 600 KB Output is correct
49 Correct 1 ms 600 KB Output is correct
50 Correct 0 ms 604 KB Output is correct
51 Correct 0 ms 604 KB Output is correct
52 Correct 0 ms 604 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 1 ms 604 KB Output is correct
55 Correct 0 ms 604 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 0 ms 604 KB Output is correct
58 Correct 0 ms 604 KB Output is correct
59 Correct 1 ms 604 KB Output is correct
60 Correct 1 ms 604 KB Output is correct
61 Correct 1 ms 604 KB Output is correct
62 Correct 1 ms 684 KB Output is correct
63 Correct 1 ms 604 KB Output is correct
64 Correct 1 ms 604 KB Output is correct
65 Correct 1 ms 600 KB Output is correct
66 Correct 1 ms 604 KB Output is correct
67 Correct 1 ms 604 KB Output is correct
68 Correct 1 ms 604 KB Output is correct
69 Correct 1 ms 600 KB Output is correct
70 Correct 1 ms 600 KB Output is correct
71 Correct 1 ms 604 KB Output is correct
72 Correct 0 ms 604 KB Output is correct
73 Correct 1 ms 696 KB Output is correct
74 Correct 1 ms 604 KB Output is correct
75 Correct 1 ms 604 KB Output is correct
76 Correct 0 ms 604 KB Output is correct
77 Correct 1 ms 604 KB Output is correct
78 Correct 1 ms 604 KB Output is correct
79 Correct 0 ms 604 KB Output is correct
80 Correct 1 ms 604 KB Output is correct
81 Correct 1 ms 600 KB Output is correct
82 Correct 0 ms 604 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 1 ms 604 KB Output is correct
85 Correct 0 ms 604 KB Output is correct
86 Correct 1 ms 604 KB Output is correct
87 Correct 1 ms 604 KB Output is correct
88 Correct 1 ms 604 KB Output is correct
89 Correct 0 ms 604 KB Output is correct
90 Correct 0 ms 684 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 3 ms 2652 KB Output is correct
5 Correct 3 ms 2652 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 4 ms 2652 KB Output is correct
8 Correct 4 ms 2652 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 2 ms 2648 KB Output is correct
11 Correct 2 ms 2652 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 2 ms 2648 KB Output is correct
14 Correct 3 ms 2648 KB Output is correct
15 Correct 3 ms 2652 KB Output is correct
16 Correct 3 ms 2396 KB Output is correct
17 Correct 4 ms 2396 KB Output is correct
18 Correct 3 ms 2652 KB Output is correct
19 Correct 3 ms 2652 KB Output is correct
20 Correct 3 ms 2652 KB Output is correct
21 Correct 3 ms 2780 KB Output is correct
22 Correct 3 ms 2648 KB Output is correct
23 Correct 4 ms 2652 KB Output is correct
24 Correct 3 ms 2652 KB Output is correct
25 Correct 3 ms 2648 KB Output is correct
26 Correct 3 ms 2652 KB Output is correct
27 Correct 3 ms 2652 KB Output is correct
28 Correct 3 ms 2652 KB Output is correct
29 Correct 3 ms 2648 KB Output is correct
30 Correct 3 ms 2652 KB Output is correct
31 Correct 5 ms 2648 KB Output is correct
32 Correct 5 ms 2648 KB Output is correct
33 Correct 3 ms 2396 KB Output is correct
34 Correct 3 ms 2396 KB Output is correct
35 Correct 3 ms 2396 KB Output is correct
36 Correct 2 ms 2396 KB Output is correct
37 Correct 2 ms 2652 KB Output is correct
38 Correct 2 ms 2396 KB Output is correct
39 Correct 2 ms 2596 KB Output is correct
40 Correct 2 ms 2648 KB Output is correct
41 Correct 3 ms 2392 KB Output is correct
42 Correct 3 ms 2648 KB Output is correct
43 Correct 3 ms 2652 KB Output is correct
44 Correct 3 ms 2652 KB Output is correct
45 Correct 4 ms 2652 KB Output is correct
46 Correct 1 ms 2396 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 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 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 1 ms 600 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 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 416 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 400 KB Output is correct
39 Correct 0 ms 344 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 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 600 KB Output is correct
49 Correct 1 ms 600 KB Output is correct
50 Correct 0 ms 604 KB Output is correct
51 Correct 0 ms 604 KB Output is correct
52 Correct 0 ms 604 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 1 ms 604 KB Output is correct
55 Correct 0 ms 604 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 0 ms 604 KB Output is correct
58 Correct 0 ms 604 KB Output is correct
59 Correct 1 ms 604 KB Output is correct
60 Correct 1 ms 604 KB Output is correct
61 Correct 1 ms 604 KB Output is correct
62 Correct 1 ms 684 KB Output is correct
63 Correct 1 ms 604 KB Output is correct
64 Correct 1 ms 604 KB Output is correct
65 Correct 1 ms 600 KB Output is correct
66 Correct 1 ms 604 KB Output is correct
67 Correct 1 ms 604 KB Output is correct
68 Correct 1 ms 604 KB Output is correct
69 Correct 1 ms 600 KB Output is correct
70 Correct 1 ms 600 KB Output is correct
71 Correct 1 ms 604 KB Output is correct
72 Correct 0 ms 604 KB Output is correct
73 Correct 1 ms 696 KB Output is correct
74 Correct 1 ms 604 KB Output is correct
75 Correct 1 ms 604 KB Output is correct
76 Correct 0 ms 604 KB Output is correct
77 Correct 1 ms 604 KB Output is correct
78 Correct 1 ms 604 KB Output is correct
79 Correct 0 ms 604 KB Output is correct
80 Correct 1 ms 604 KB Output is correct
81 Correct 1 ms 600 KB Output is correct
82 Correct 0 ms 604 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 1 ms 604 KB Output is correct
85 Correct 0 ms 604 KB Output is correct
86 Correct 1 ms 604 KB Output is correct
87 Correct 1 ms 604 KB Output is correct
88 Correct 1 ms 604 KB Output is correct
89 Correct 0 ms 604 KB Output is correct
90 Correct 0 ms 684 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 3 ms 2652 KB Output is correct
93 Correct 3 ms 2652 KB Output is correct
94 Correct 1 ms 604 KB Output is correct
95 Correct 4 ms 2652 KB Output is correct
96 Correct 4 ms 2652 KB Output is correct
97 Correct 1 ms 1116 KB Output is correct
98 Correct 2 ms 2648 KB Output is correct
99 Correct 2 ms 2652 KB Output is correct
100 Correct 1 ms 1116 KB Output is correct
101 Correct 2 ms 2648 KB Output is correct
102 Correct 3 ms 2648 KB Output is correct
103 Correct 3 ms 2652 KB Output is correct
104 Correct 3 ms 2396 KB Output is correct
105 Correct 4 ms 2396 KB Output is correct
106 Correct 3 ms 2652 KB Output is correct
107 Correct 3 ms 2652 KB Output is correct
108 Correct 3 ms 2652 KB Output is correct
109 Correct 3 ms 2780 KB Output is correct
110 Correct 3 ms 2648 KB Output is correct
111 Correct 4 ms 2652 KB Output is correct
112 Correct 3 ms 2652 KB Output is correct
113 Correct 3 ms 2648 KB Output is correct
114 Correct 3 ms 2652 KB Output is correct
115 Correct 3 ms 2652 KB Output is correct
116 Correct 3 ms 2652 KB Output is correct
117 Correct 3 ms 2648 KB Output is correct
118 Correct 3 ms 2652 KB Output is correct
119 Correct 5 ms 2648 KB Output is correct
120 Correct 5 ms 2648 KB Output is correct
121 Correct 3 ms 2396 KB Output is correct
122 Correct 3 ms 2396 KB Output is correct
123 Correct 3 ms 2396 KB Output is correct
124 Correct 2 ms 2396 KB Output is correct
125 Correct 2 ms 2652 KB Output is correct
126 Correct 2 ms 2396 KB Output is correct
127 Correct 2 ms 2596 KB Output is correct
128 Correct 2 ms 2648 KB Output is correct
129 Correct 3 ms 2392 KB Output is correct
130 Correct 3 ms 2648 KB Output is correct
131 Correct 3 ms 2652 KB Output is correct
132 Correct 3 ms 2652 KB Output is correct
133 Correct 4 ms 2652 KB Output is correct
134 Correct 1 ms 2396 KB Output is correct
135 Correct 1 ms 1372 KB Output is correct
136 Correct 4 ms 3676 KB Output is correct
137 Correct 2 ms 3676 KB Output is correct
138 Correct 1 ms 1372 KB Output is correct
139 Correct 3 ms 3676 KB Output is correct
140 Correct 3 ms 3676 KB Output is correct
141 Correct 1 ms 1628 KB Output is correct
142 Correct 3 ms 3676 KB Output is correct
143 Correct 2 ms 3676 KB Output is correct
144 Correct 0 ms 348 KB Output is correct
145 Correct 3 ms 3676 KB Output is correct
146 Correct 3 ms 3676 KB Output is correct
147 Correct 4 ms 3416 KB Output is correct
148 Correct 4 ms 3520 KB Output is correct
149 Correct 5 ms 3336 KB Output is correct
150 Correct 5 ms 3780 KB Output is correct
151 Correct 5 ms 3784 KB Output is correct
152 Correct 5 ms 3676 KB Output is correct
153 Correct 5 ms 3784 KB Output is correct
154 Correct 8 ms 3784 KB Output is correct
155 Correct 5 ms 3784 KB Output is correct
156 Correct 5 ms 3676 KB Output is correct
157 Correct 5 ms 3784 KB Output is correct
158 Correct 5 ms 3628 KB Output is correct
159 Correct 5 ms 3676 KB Output is correct
160 Correct 4 ms 3676 KB Output is correct
161 Correct 5 ms 3676 KB Output is correct
162 Correct 5 ms 3420 KB Output is correct
163 Correct 5 ms 3412 KB Output is correct
164 Correct 7 ms 3416 KB Output is correct
165 Correct 5 ms 3160 KB Output is correct
166 Correct 5 ms 3420 KB Output is correct
167 Correct 4 ms 3416 KB Output is correct
168 Correct 3 ms 3420 KB Output is correct
169 Correct 3 ms 3420 KB Output is correct
170 Correct 4 ms 3420 KB Output is correct
171 Correct 6 ms 3420 KB Output is correct
172 Correct 3 ms 3164 KB Output is correct
173 Correct 4 ms 3528 KB Output is correct
174 Correct 4 ms 3788 KB Output is correct
175 Correct 5 ms 3704 KB Output is correct
176 Correct 5 ms 3676 KB Output is correct
177 Correct 5 ms 3776 KB Output is correct
178 Correct 2 ms 3420 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 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 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 1 ms 600 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 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 416 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 400 KB Output is correct
39 Correct 0 ms 344 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 348 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 0 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 600 KB Output is correct
49 Correct 1 ms 600 KB Output is correct
50 Correct 0 ms 604 KB Output is correct
51 Correct 0 ms 604 KB Output is correct
52 Correct 0 ms 604 KB Output is correct
53 Correct 0 ms 348 KB Output is correct
54 Correct 1 ms 604 KB Output is correct
55 Correct 0 ms 604 KB Output is correct
56 Correct 1 ms 348 KB Output is correct
57 Correct 0 ms 604 KB Output is correct
58 Correct 0 ms 604 KB Output is correct
59 Correct 1 ms 604 KB Output is correct
60 Correct 1 ms 604 KB Output is correct
61 Correct 1 ms 604 KB Output is correct
62 Correct 1 ms 684 KB Output is correct
63 Correct 1 ms 604 KB Output is correct
64 Correct 1 ms 604 KB Output is correct
65 Correct 1 ms 600 KB Output is correct
66 Correct 1 ms 604 KB Output is correct
67 Correct 1 ms 604 KB Output is correct
68 Correct 1 ms 604 KB Output is correct
69 Correct 1 ms 600 KB Output is correct
70 Correct 1 ms 600 KB Output is correct
71 Correct 1 ms 604 KB Output is correct
72 Correct 0 ms 604 KB Output is correct
73 Correct 1 ms 696 KB Output is correct
74 Correct 1 ms 604 KB Output is correct
75 Correct 1 ms 604 KB Output is correct
76 Correct 0 ms 604 KB Output is correct
77 Correct 1 ms 604 KB Output is correct
78 Correct 1 ms 604 KB Output is correct
79 Correct 0 ms 604 KB Output is correct
80 Correct 1 ms 604 KB Output is correct
81 Correct 1 ms 600 KB Output is correct
82 Correct 0 ms 604 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 1 ms 604 KB Output is correct
85 Correct 0 ms 604 KB Output is correct
86 Correct 1 ms 604 KB Output is correct
87 Correct 1 ms 604 KB Output is correct
88 Correct 1 ms 604 KB Output is correct
89 Correct 0 ms 604 KB Output is correct
90 Correct 0 ms 684 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 3 ms 2652 KB Output is correct
93 Correct 3 ms 2652 KB Output is correct
94 Correct 1 ms 604 KB Output is correct
95 Correct 4 ms 2652 KB Output is correct
96 Correct 4 ms 2652 KB Output is correct
97 Correct 1 ms 1116 KB Output is correct
98 Correct 2 ms 2648 KB Output is correct
99 Correct 2 ms 2652 KB Output is correct
100 Correct 1 ms 1116 KB Output is correct
101 Correct 2 ms 2648 KB Output is correct
102 Correct 3 ms 2648 KB Output is correct
103 Correct 3 ms 2652 KB Output is correct
104 Correct 3 ms 2396 KB Output is correct
105 Correct 4 ms 2396 KB Output is correct
106 Correct 3 ms 2652 KB Output is correct
107 Correct 3 ms 2652 KB Output is correct
108 Correct 3 ms 2652 KB Output is correct
109 Correct 3 ms 2780 KB Output is correct
110 Correct 3 ms 2648 KB Output is correct
111 Correct 4 ms 2652 KB Output is correct
112 Correct 3 ms 2652 KB Output is correct
113 Correct 3 ms 2648 KB Output is correct
114 Correct 3 ms 2652 KB Output is correct
115 Correct 3 ms 2652 KB Output is correct
116 Correct 3 ms 2652 KB Output is correct
117 Correct 3 ms 2648 KB Output is correct
118 Correct 3 ms 2652 KB Output is correct
119 Correct 5 ms 2648 KB Output is correct
120 Correct 5 ms 2648 KB Output is correct
121 Correct 3 ms 2396 KB Output is correct
122 Correct 3 ms 2396 KB Output is correct
123 Correct 3 ms 2396 KB Output is correct
124 Correct 2 ms 2396 KB Output is correct
125 Correct 2 ms 2652 KB Output is correct
126 Correct 2 ms 2396 KB Output is correct
127 Correct 2 ms 2596 KB Output is correct
128 Correct 2 ms 2648 KB Output is correct
129 Correct 3 ms 2392 KB Output is correct
130 Correct 3 ms 2648 KB Output is correct
131 Correct 3 ms 2652 KB Output is correct
132 Correct 3 ms 2652 KB Output is correct
133 Correct 4 ms 2652 KB Output is correct
134 Correct 1 ms 2396 KB Output is correct
135 Correct 1 ms 1372 KB Output is correct
136 Correct 4 ms 3676 KB Output is correct
137 Correct 2 ms 3676 KB Output is correct
138 Correct 1 ms 1372 KB Output is correct
139 Correct 3 ms 3676 KB Output is correct
140 Correct 3 ms 3676 KB Output is correct
141 Correct 1 ms 1628 KB Output is correct
142 Correct 3 ms 3676 KB Output is correct
143 Correct 2 ms 3676 KB Output is correct
144 Correct 0 ms 348 KB Output is correct
145 Correct 3 ms 3676 KB Output is correct
146 Correct 3 ms 3676 KB Output is correct
147 Correct 4 ms 3416 KB Output is correct
148 Correct 4 ms 3520 KB Output is correct
149 Correct 5 ms 3336 KB Output is correct
150 Correct 5 ms 3780 KB Output is correct
151 Correct 5 ms 3784 KB Output is correct
152 Correct 5 ms 3676 KB Output is correct
153 Correct 5 ms 3784 KB Output is correct
154 Correct 8 ms 3784 KB Output is correct
155 Correct 5 ms 3784 KB Output is correct
156 Correct 5 ms 3676 KB Output is correct
157 Correct 5 ms 3784 KB Output is correct
158 Correct 5 ms 3628 KB Output is correct
159 Correct 5 ms 3676 KB Output is correct
160 Correct 4 ms 3676 KB Output is correct
161 Correct 5 ms 3676 KB Output is correct
162 Correct 5 ms 3420 KB Output is correct
163 Correct 5 ms 3412 KB Output is correct
164 Correct 7 ms 3416 KB Output is correct
165 Correct 5 ms 3160 KB Output is correct
166 Correct 5 ms 3420 KB Output is correct
167 Correct 4 ms 3416 KB Output is correct
168 Correct 3 ms 3420 KB Output is correct
169 Correct 3 ms 3420 KB Output is correct
170 Correct 4 ms 3420 KB Output is correct
171 Correct 6 ms 3420 KB Output is correct
172 Correct 3 ms 3164 KB Output is correct
173 Correct 4 ms 3528 KB Output is correct
174 Correct 4 ms 3788 KB Output is correct
175 Correct 5 ms 3704 KB Output is correct
176 Correct 5 ms 3676 KB Output is correct
177 Correct 5 ms 3776 KB Output is correct
178 Correct 2 ms 3420 KB Output is correct
179 Correct 12 ms 14936 KB Output is correct
180 Correct 43 ms 56404 KB Output is correct
181 Correct 40 ms 56412 KB Output is correct
182 Correct 11 ms 15196 KB Output is correct
183 Correct 45 ms 56320 KB Output is correct
184 Correct 45 ms 56328 KB Output is correct
185 Correct 31 ms 41548 KB Output is correct
186 Correct 43 ms 56400 KB Output is correct
187 Correct 41 ms 56404 KB Output is correct
188 Correct 27 ms 29528 KB Output is correct
189 Correct 53 ms 56404 KB Output is correct
190 Correct 53 ms 56404 KB Output is correct
191 Correct 100 ms 47968 KB Output is correct
192 Correct 89 ms 51424 KB Output is correct
193 Correct 92 ms 50536 KB Output is correct
194 Correct 91 ms 56332 KB Output is correct
195 Correct 85 ms 56400 KB Output is correct
196 Correct 86 ms 56404 KB Output is correct
197 Correct 85 ms 56436 KB Output is correct
198 Correct 99 ms 56284 KB Output is correct
199 Correct 90 ms 56444 KB Output is correct
200 Correct 103 ms 56400 KB Output is correct
201 Correct 101 ms 56428 KB Output is correct
202 Correct 86 ms 56400 KB Output is correct
203 Correct 90 ms 56404 KB Output is correct
204 Correct 88 ms 56356 KB Output is correct
205 Correct 91 ms 56432 KB Output is correct
206 Correct 75 ms 49232 KB Output is correct
207 Correct 80 ms 49884 KB Output is correct
208 Correct 72 ms 47192 KB Output is correct
209 Correct 78 ms 50620 KB Output is correct
210 Correct 79 ms 50392 KB Output is correct
211 Correct 80 ms 53328 KB Output is correct
212 Correct 36 ms 48476 KB Output is correct
213 Correct 53 ms 50772 KB Output is correct
214 Correct 60 ms 48212 KB Output is correct
215 Correct 54 ms 51792 KB Output is correct
216 Correct 51 ms 47188 KB Output is correct
217 Correct 56 ms 48168 KB Output is correct
218 Correct 86 ms 56352 KB Output is correct
219 Correct 119 ms 56448 KB Output is correct
220 Correct 87 ms 56448 KB Output is correct
221 Correct 93 ms 56444 KB Output is correct
222 Correct 34 ms 47404 KB Output is correct