// Author: Dan Skýpala
// O(wh) correct solution
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_set>
using namespace std;
int w, h, k, l;
int xh0, yh0, xv0, yv0;
vector<vector<bool>> field;
vector<vector<int>> up_space, down_space, left_space, right_space;
int tx=-1, ty=-1;
struct raw_pos {
int x, y;
bool const operator==(const raw_pos& p) const {
return (x == p.x && y == p.y);
}
};
struct pos : raw_pos {
pos(int x1, int y1) {
x = x1;
y = y1;
}
bool isValid(const pos& new_p) const {
return (
min(left_space[y][x], left_space[new_p.y][new_p.x]) + min(right_space[y][x], right_space[new_p.y][new_p.x]) - (x == new_p.x) >= k
&&
min(up_space[y][x], up_space[new_p.y][new_p.x]) + min(down_space[y][x], down_space[new_p.y][new_p.x]) - (y == new_p.y) >= l
);
}
};
struct Hash {
size_t operator() (const pos& p) const {
return p.x + (p.y << 11);
}
};
queue<pos> q;
unordered_set<pos, Hash> vis;
void add(const pos& p, const pos& new_p) {
if (p.isValid(new_p) && vis.count(new_p) == 0) {
q.push(new_p);
vis.insert(new_p);
}
}
bool search(pos p0) {
add(p0, p0);
while (q.size()) {
pos p = q.front(); q.pop();
#ifdef DBG
vector<vector<char>> f(h, vector<char>(w, '.'));
for (int i=0; i<w+5; i++)
cout << "-";
cout << endl;
f[p.y][p.x] = '+';
f[ty][tx] = '*';
for (int i=0; i<h; i++) {
for (int j=0; j<w; j++) {
if (!field[i][j])
cout << "#";
else
cout << f[i][j];
}
cout << endl;
}
#endif
if (p.x == tx && p.y == ty) {
return true;
}
add(p, {p.x-1, p.y});
add(p, {p.x+1, p.y});
add(p, {p.x, p.y-1});
add(p, {p.x, p.y+1});
}
return false;
}
int calc_space(vector<vector<int>>& s, int x, int y, int dx, int dy) {
if (s[y][x] == -1) {
if (field[y][x]) {
s[y][x] = calc_space(s, x+dx, y+dy, dx, dy) + 1;
} else {
s[y][x] = 0;
}
}
return s[y][x];
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> w >> h >> k >> l;
w += 2; h += 2;
field.resize(h, vector<bool>(w, false));
left_space.resize(h, vector<int>(w, -1));
right_space.resize(h, vector<int>(w, -1));
down_space.resize(h, vector<int>(w, -1));
up_space.resize(h, vector<int>(w, -1));
cin >> xh0 >> yh0 >> xv0 >> yv0;
xh0++; yh0++; xv0++; yv0++;
for (int y=1; y<h-1; y++) {
string row;
cin >> row;
for (int x=1; x<w-1; x++) {
if (row[x-1] == '*') {
ty = y; tx = x;
}
field[y][x] = (row[x-1] != 'X');
}
}
for (int y=0; y<h; y++) {
for (int x=0; x<w; x++) {
calc_space(left_space, x, y, -1, 0);
calc_space(right_space, x, y, 1, 0);
calc_space(up_space, x, y, 0, -1);
calc_space(down_space, x, y, 0, 1);
}
}
if (search({xv0, yh0})) {
cout << "YES" << endl;
} else {
cout << "NO" << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
1 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
604 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Correct |
1 ms |
604 KB |
Output is correct |
23 |
Correct |
1 ms |
604 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
25 |
Correct |
1 ms |
600 KB |
Output is correct |
26 |
Correct |
1 ms |
600 KB |
Output is correct |
27 |
Correct |
1 ms |
448 KB |
Output is correct |
28 |
Correct |
1 ms |
604 KB |
Output is correct |
29 |
Correct |
1 ms |
604 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
372 KB |
Output is correct |
33 |
Correct |
1 ms |
604 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
552 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 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 |
1 ms |
604 KB |
Output is correct |
44 |
Correct |
0 ms |
344 KB |
Output is correct |
45 |
Correct |
0 ms |
348 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
1 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
604 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Correct |
1 ms |
604 KB |
Output is correct |
23 |
Correct |
1 ms |
604 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
25 |
Correct |
1 ms |
600 KB |
Output is correct |
26 |
Correct |
1 ms |
600 KB |
Output is correct |
27 |
Correct |
1 ms |
448 KB |
Output is correct |
28 |
Correct |
1 ms |
604 KB |
Output is correct |
29 |
Correct |
1 ms |
604 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
372 KB |
Output is correct |
33 |
Correct |
1 ms |
604 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
552 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 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 |
1 ms |
604 KB |
Output is correct |
44 |
Correct |
0 ms |
344 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 |
604 KB |
Output is correct |
49 |
Correct |
1 ms |
604 KB |
Output is correct |
50 |
Correct |
1 ms |
348 KB |
Output is correct |
51 |
Correct |
1 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 |
1 ms |
604 KB |
Output is correct |
58 |
Correct |
1 ms |
604 KB |
Output is correct |
59 |
Correct |
1 ms |
860 KB |
Output is correct |
60 |
Correct |
1 ms |
860 KB |
Output is correct |
61 |
Correct |
3 ms |
860 KB |
Output is correct |
62 |
Correct |
1 ms |
860 KB |
Output is correct |
63 |
Correct |
2 ms |
860 KB |
Output is correct |
64 |
Correct |
1 ms |
864 KB |
Output is correct |
65 |
Correct |
1 ms |
864 KB |
Output is correct |
66 |
Correct |
1 ms |
860 KB |
Output is correct |
67 |
Correct |
2 ms |
864 KB |
Output is correct |
68 |
Correct |
2 ms |
1112 KB |
Output is correct |
69 |
Correct |
1 ms |
864 KB |
Output is correct |
70 |
Correct |
2 ms |
860 KB |
Output is correct |
71 |
Correct |
3 ms |
860 KB |
Output is correct |
72 |
Correct |
1 ms |
860 KB |
Output is correct |
73 |
Correct |
1 ms |
860 KB |
Output is correct |
74 |
Correct |
1 ms |
604 KB |
Output is correct |
75 |
Correct |
1 ms |
860 KB |
Output is correct |
76 |
Correct |
1 ms |
604 KB |
Output is correct |
77 |
Correct |
2 ms |
856 KB |
Output is correct |
78 |
Correct |
1 ms |
604 KB |
Output is correct |
79 |
Correct |
1 ms |
860 KB |
Output is correct |
80 |
Correct |
0 ms |
604 KB |
Output is correct |
81 |
Correct |
1 ms |
604 KB |
Output is correct |
82 |
Correct |
1 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 |
1 ms |
604 KB |
Output is correct |
86 |
Correct |
1 ms |
860 KB |
Output is correct |
87 |
Correct |
1 ms |
604 KB |
Output is correct |
88 |
Correct |
1 ms |
604 KB |
Output is correct |
89 |
Correct |
1 ms |
604 KB |
Output is correct |
90 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
4092 KB |
Output is correct |
5 |
Correct |
4 ms |
1884 KB |
Output is correct |
6 |
Correct |
1 ms |
860 KB |
Output is correct |
7 |
Correct |
11 ms |
4292 KB |
Output is correct |
8 |
Correct |
7 ms |
3000 KB |
Output is correct |
9 |
Correct |
1 ms |
860 KB |
Output is correct |
10 |
Correct |
4 ms |
1952 KB |
Output is correct |
11 |
Correct |
5 ms |
1880 KB |
Output is correct |
12 |
Correct |
2 ms |
860 KB |
Output is correct |
13 |
Correct |
4 ms |
1884 KB |
Output is correct |
14 |
Correct |
4 ms |
1884 KB |
Output is correct |
15 |
Correct |
13 ms |
4968 KB |
Output is correct |
16 |
Correct |
13 ms |
4972 KB |
Output is correct |
17 |
Correct |
12 ms |
4908 KB |
Output is correct |
18 |
Correct |
14 ms |
6508 KB |
Output is correct |
19 |
Correct |
14 ms |
6580 KB |
Output is correct |
20 |
Correct |
15 ms |
6504 KB |
Output is correct |
21 |
Correct |
13 ms |
6508 KB |
Output is correct |
22 |
Correct |
14 ms |
6508 KB |
Output is correct |
23 |
Correct |
14 ms |
6508 KB |
Output is correct |
24 |
Correct |
14 ms |
6508 KB |
Output is correct |
25 |
Correct |
13 ms |
6576 KB |
Output is correct |
26 |
Correct |
12 ms |
4972 KB |
Output is correct |
27 |
Correct |
12 ms |
5040 KB |
Output is correct |
28 |
Correct |
12 ms |
4972 KB |
Output is correct |
29 |
Correct |
13 ms |
4972 KB |
Output is correct |
30 |
Correct |
4 ms |
1884 KB |
Output is correct |
31 |
Correct |
12 ms |
5068 KB |
Output is correct |
32 |
Correct |
7 ms |
3256 KB |
Output is correct |
33 |
Correct |
11 ms |
5068 KB |
Output is correct |
34 |
Correct |
6 ms |
3000 KB |
Output is correct |
35 |
Correct |
5 ms |
2396 KB |
Output is correct |
36 |
Correct |
3 ms |
1628 KB |
Output is correct |
37 |
Correct |
7 ms |
3000 KB |
Output is correct |
38 |
Correct |
6 ms |
2948 KB |
Output is correct |
39 |
Correct |
6 ms |
2964 KB |
Output is correct |
40 |
Correct |
6 ms |
3000 KB |
Output is correct |
41 |
Correct |
6 ms |
3000 KB |
Output is correct |
42 |
Correct |
13 ms |
5228 KB |
Output is correct |
43 |
Correct |
10 ms |
4280 KB |
Output is correct |
44 |
Correct |
5 ms |
2396 KB |
Output is correct |
45 |
Correct |
11 ms |
4460 KB |
Output is correct |
46 |
Correct |
2 ms |
1628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
1 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
604 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Correct |
1 ms |
604 KB |
Output is correct |
23 |
Correct |
1 ms |
604 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
25 |
Correct |
1 ms |
600 KB |
Output is correct |
26 |
Correct |
1 ms |
600 KB |
Output is correct |
27 |
Correct |
1 ms |
448 KB |
Output is correct |
28 |
Correct |
1 ms |
604 KB |
Output is correct |
29 |
Correct |
1 ms |
604 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
372 KB |
Output is correct |
33 |
Correct |
1 ms |
604 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
552 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 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 |
1 ms |
604 KB |
Output is correct |
44 |
Correct |
0 ms |
344 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 |
604 KB |
Output is correct |
49 |
Correct |
1 ms |
604 KB |
Output is correct |
50 |
Correct |
1 ms |
348 KB |
Output is correct |
51 |
Correct |
1 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 |
1 ms |
604 KB |
Output is correct |
58 |
Correct |
1 ms |
604 KB |
Output is correct |
59 |
Correct |
1 ms |
860 KB |
Output is correct |
60 |
Correct |
1 ms |
860 KB |
Output is correct |
61 |
Correct |
3 ms |
860 KB |
Output is correct |
62 |
Correct |
1 ms |
860 KB |
Output is correct |
63 |
Correct |
2 ms |
860 KB |
Output is correct |
64 |
Correct |
1 ms |
864 KB |
Output is correct |
65 |
Correct |
1 ms |
864 KB |
Output is correct |
66 |
Correct |
1 ms |
860 KB |
Output is correct |
67 |
Correct |
2 ms |
864 KB |
Output is correct |
68 |
Correct |
2 ms |
1112 KB |
Output is correct |
69 |
Correct |
1 ms |
864 KB |
Output is correct |
70 |
Correct |
2 ms |
860 KB |
Output is correct |
71 |
Correct |
3 ms |
860 KB |
Output is correct |
72 |
Correct |
1 ms |
860 KB |
Output is correct |
73 |
Correct |
1 ms |
860 KB |
Output is correct |
74 |
Correct |
1 ms |
604 KB |
Output is correct |
75 |
Correct |
1 ms |
860 KB |
Output is correct |
76 |
Correct |
1 ms |
604 KB |
Output is correct |
77 |
Correct |
2 ms |
856 KB |
Output is correct |
78 |
Correct |
1 ms |
604 KB |
Output is correct |
79 |
Correct |
1 ms |
860 KB |
Output is correct |
80 |
Correct |
0 ms |
604 KB |
Output is correct |
81 |
Correct |
1 ms |
604 KB |
Output is correct |
82 |
Correct |
1 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 |
1 ms |
604 KB |
Output is correct |
86 |
Correct |
1 ms |
860 KB |
Output is correct |
87 |
Correct |
1 ms |
604 KB |
Output is correct |
88 |
Correct |
1 ms |
604 KB |
Output is correct |
89 |
Correct |
1 ms |
604 KB |
Output is correct |
90 |
Correct |
1 ms |
604 KB |
Output is correct |
91 |
Correct |
1 ms |
348 KB |
Output is correct |
92 |
Correct |
10 ms |
4092 KB |
Output is correct |
93 |
Correct |
4 ms |
1884 KB |
Output is correct |
94 |
Correct |
1 ms |
860 KB |
Output is correct |
95 |
Correct |
11 ms |
4292 KB |
Output is correct |
96 |
Correct |
7 ms |
3000 KB |
Output is correct |
97 |
Correct |
1 ms |
860 KB |
Output is correct |
98 |
Correct |
4 ms |
1952 KB |
Output is correct |
99 |
Correct |
5 ms |
1880 KB |
Output is correct |
100 |
Correct |
2 ms |
860 KB |
Output is correct |
101 |
Correct |
4 ms |
1884 KB |
Output is correct |
102 |
Correct |
4 ms |
1884 KB |
Output is correct |
103 |
Correct |
13 ms |
4968 KB |
Output is correct |
104 |
Correct |
13 ms |
4972 KB |
Output is correct |
105 |
Correct |
12 ms |
4908 KB |
Output is correct |
106 |
Correct |
14 ms |
6508 KB |
Output is correct |
107 |
Correct |
14 ms |
6580 KB |
Output is correct |
108 |
Correct |
15 ms |
6504 KB |
Output is correct |
109 |
Correct |
13 ms |
6508 KB |
Output is correct |
110 |
Correct |
14 ms |
6508 KB |
Output is correct |
111 |
Correct |
14 ms |
6508 KB |
Output is correct |
112 |
Correct |
14 ms |
6508 KB |
Output is correct |
113 |
Correct |
13 ms |
6576 KB |
Output is correct |
114 |
Correct |
12 ms |
4972 KB |
Output is correct |
115 |
Correct |
12 ms |
5040 KB |
Output is correct |
116 |
Correct |
12 ms |
4972 KB |
Output is correct |
117 |
Correct |
13 ms |
4972 KB |
Output is correct |
118 |
Correct |
4 ms |
1884 KB |
Output is correct |
119 |
Correct |
12 ms |
5068 KB |
Output is correct |
120 |
Correct |
7 ms |
3256 KB |
Output is correct |
121 |
Correct |
11 ms |
5068 KB |
Output is correct |
122 |
Correct |
6 ms |
3000 KB |
Output is correct |
123 |
Correct |
5 ms |
2396 KB |
Output is correct |
124 |
Correct |
3 ms |
1628 KB |
Output is correct |
125 |
Correct |
7 ms |
3000 KB |
Output is correct |
126 |
Correct |
6 ms |
2948 KB |
Output is correct |
127 |
Correct |
6 ms |
2964 KB |
Output is correct |
128 |
Correct |
6 ms |
3000 KB |
Output is correct |
129 |
Correct |
6 ms |
3000 KB |
Output is correct |
130 |
Correct |
13 ms |
5228 KB |
Output is correct |
131 |
Correct |
10 ms |
4280 KB |
Output is correct |
132 |
Correct |
5 ms |
2396 KB |
Output is correct |
133 |
Correct |
11 ms |
4460 KB |
Output is correct |
134 |
Correct |
2 ms |
1628 KB |
Output is correct |
135 |
Correct |
2 ms |
1112 KB |
Output is correct |
136 |
Correct |
5 ms |
2392 KB |
Output is correct |
137 |
Correct |
6 ms |
2604 KB |
Output is correct |
138 |
Correct |
2 ms |
1116 KB |
Output is correct |
139 |
Correct |
5 ms |
2600 KB |
Output is correct |
140 |
Correct |
5 ms |
2596 KB |
Output is correct |
141 |
Correct |
2 ms |
1116 KB |
Output is correct |
142 |
Correct |
5 ms |
2396 KB |
Output is correct |
143 |
Correct |
6 ms |
2396 KB |
Output is correct |
144 |
Correct |
1 ms |
348 KB |
Output is correct |
145 |
Correct |
6 ms |
2592 KB |
Output is correct |
146 |
Correct |
6 ms |
2396 KB |
Output is correct |
147 |
Correct |
18 ms |
7200 KB |
Output is correct |
148 |
Correct |
26 ms |
7376 KB |
Output is correct |
149 |
Correct |
17 ms |
7120 KB |
Output is correct |
150 |
Correct |
18 ms |
7888 KB |
Output is correct |
151 |
Correct |
23 ms |
7880 KB |
Output is correct |
152 |
Correct |
32 ms |
7888 KB |
Output is correct |
153 |
Correct |
20 ms |
7888 KB |
Output is correct |
154 |
Correct |
18 ms |
7788 KB |
Output is correct |
155 |
Correct |
19 ms |
7888 KB |
Output is correct |
156 |
Correct |
20 ms |
8008 KB |
Output is correct |
157 |
Correct |
19 ms |
7888 KB |
Output is correct |
158 |
Correct |
20 ms |
7920 KB |
Output is correct |
159 |
Correct |
20 ms |
7884 KB |
Output is correct |
160 |
Correct |
22 ms |
7888 KB |
Output is correct |
161 |
Correct |
19 ms |
7796 KB |
Output is correct |
162 |
Correct |
16 ms |
7020 KB |
Output is correct |
163 |
Correct |
18 ms |
7196 KB |
Output is correct |
164 |
Correct |
6 ms |
2904 KB |
Output is correct |
165 |
Correct |
27 ms |
7112 KB |
Output is correct |
166 |
Correct |
13 ms |
5484 KB |
Output is correct |
167 |
Correct |
17 ms |
7120 KB |
Output is correct |
168 |
Correct |
4 ms |
2396 KB |
Output is correct |
169 |
Correct |
9 ms |
4020 KB |
Output is correct |
170 |
Correct |
9 ms |
3852 KB |
Output is correct |
171 |
Correct |
8 ms |
3768 KB |
Output is correct |
172 |
Correct |
13 ms |
3720 KB |
Output is correct |
173 |
Correct |
8 ms |
4020 KB |
Output is correct |
174 |
Correct |
10 ms |
4024 KB |
Output is correct |
175 |
Correct |
9 ms |
3976 KB |
Output is correct |
176 |
Correct |
9 ms |
4024 KB |
Output is correct |
177 |
Correct |
8 ms |
3680 KB |
Output is correct |
178 |
Correct |
3 ms |
2140 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 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 |
0 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 |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
1 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
604 KB |
Output is correct |
21 |
Correct |
1 ms |
604 KB |
Output is correct |
22 |
Correct |
1 ms |
604 KB |
Output is correct |
23 |
Correct |
1 ms |
604 KB |
Output is correct |
24 |
Correct |
1 ms |
604 KB |
Output is correct |
25 |
Correct |
1 ms |
600 KB |
Output is correct |
26 |
Correct |
1 ms |
600 KB |
Output is correct |
27 |
Correct |
1 ms |
448 KB |
Output is correct |
28 |
Correct |
1 ms |
604 KB |
Output is correct |
29 |
Correct |
1 ms |
604 KB |
Output is correct |
30 |
Correct |
1 ms |
348 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
372 KB |
Output is correct |
33 |
Correct |
1 ms |
604 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
552 KB |
Output is correct |
36 |
Correct |
0 ms |
348 KB |
Output is correct |
37 |
Correct |
1 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 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 |
1 ms |
604 KB |
Output is correct |
44 |
Correct |
0 ms |
344 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 |
604 KB |
Output is correct |
49 |
Correct |
1 ms |
604 KB |
Output is correct |
50 |
Correct |
1 ms |
348 KB |
Output is correct |
51 |
Correct |
1 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 |
1 ms |
604 KB |
Output is correct |
58 |
Correct |
1 ms |
604 KB |
Output is correct |
59 |
Correct |
1 ms |
860 KB |
Output is correct |
60 |
Correct |
1 ms |
860 KB |
Output is correct |
61 |
Correct |
3 ms |
860 KB |
Output is correct |
62 |
Correct |
1 ms |
860 KB |
Output is correct |
63 |
Correct |
2 ms |
860 KB |
Output is correct |
64 |
Correct |
1 ms |
864 KB |
Output is correct |
65 |
Correct |
1 ms |
864 KB |
Output is correct |
66 |
Correct |
1 ms |
860 KB |
Output is correct |
67 |
Correct |
2 ms |
864 KB |
Output is correct |
68 |
Correct |
2 ms |
1112 KB |
Output is correct |
69 |
Correct |
1 ms |
864 KB |
Output is correct |
70 |
Correct |
2 ms |
860 KB |
Output is correct |
71 |
Correct |
3 ms |
860 KB |
Output is correct |
72 |
Correct |
1 ms |
860 KB |
Output is correct |
73 |
Correct |
1 ms |
860 KB |
Output is correct |
74 |
Correct |
1 ms |
604 KB |
Output is correct |
75 |
Correct |
1 ms |
860 KB |
Output is correct |
76 |
Correct |
1 ms |
604 KB |
Output is correct |
77 |
Correct |
2 ms |
856 KB |
Output is correct |
78 |
Correct |
1 ms |
604 KB |
Output is correct |
79 |
Correct |
1 ms |
860 KB |
Output is correct |
80 |
Correct |
0 ms |
604 KB |
Output is correct |
81 |
Correct |
1 ms |
604 KB |
Output is correct |
82 |
Correct |
1 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 |
1 ms |
604 KB |
Output is correct |
86 |
Correct |
1 ms |
860 KB |
Output is correct |
87 |
Correct |
1 ms |
604 KB |
Output is correct |
88 |
Correct |
1 ms |
604 KB |
Output is correct |
89 |
Correct |
1 ms |
604 KB |
Output is correct |
90 |
Correct |
1 ms |
604 KB |
Output is correct |
91 |
Correct |
1 ms |
348 KB |
Output is correct |
92 |
Correct |
10 ms |
4092 KB |
Output is correct |
93 |
Correct |
4 ms |
1884 KB |
Output is correct |
94 |
Correct |
1 ms |
860 KB |
Output is correct |
95 |
Correct |
11 ms |
4292 KB |
Output is correct |
96 |
Correct |
7 ms |
3000 KB |
Output is correct |
97 |
Correct |
1 ms |
860 KB |
Output is correct |
98 |
Correct |
4 ms |
1952 KB |
Output is correct |
99 |
Correct |
5 ms |
1880 KB |
Output is correct |
100 |
Correct |
2 ms |
860 KB |
Output is correct |
101 |
Correct |
4 ms |
1884 KB |
Output is correct |
102 |
Correct |
4 ms |
1884 KB |
Output is correct |
103 |
Correct |
13 ms |
4968 KB |
Output is correct |
104 |
Correct |
13 ms |
4972 KB |
Output is correct |
105 |
Correct |
12 ms |
4908 KB |
Output is correct |
106 |
Correct |
14 ms |
6508 KB |
Output is correct |
107 |
Correct |
14 ms |
6580 KB |
Output is correct |
108 |
Correct |
15 ms |
6504 KB |
Output is correct |
109 |
Correct |
13 ms |
6508 KB |
Output is correct |
110 |
Correct |
14 ms |
6508 KB |
Output is correct |
111 |
Correct |
14 ms |
6508 KB |
Output is correct |
112 |
Correct |
14 ms |
6508 KB |
Output is correct |
113 |
Correct |
13 ms |
6576 KB |
Output is correct |
114 |
Correct |
12 ms |
4972 KB |
Output is correct |
115 |
Correct |
12 ms |
5040 KB |
Output is correct |
116 |
Correct |
12 ms |
4972 KB |
Output is correct |
117 |
Correct |
13 ms |
4972 KB |
Output is correct |
118 |
Correct |
4 ms |
1884 KB |
Output is correct |
119 |
Correct |
12 ms |
5068 KB |
Output is correct |
120 |
Correct |
7 ms |
3256 KB |
Output is correct |
121 |
Correct |
11 ms |
5068 KB |
Output is correct |
122 |
Correct |
6 ms |
3000 KB |
Output is correct |
123 |
Correct |
5 ms |
2396 KB |
Output is correct |
124 |
Correct |
3 ms |
1628 KB |
Output is correct |
125 |
Correct |
7 ms |
3000 KB |
Output is correct |
126 |
Correct |
6 ms |
2948 KB |
Output is correct |
127 |
Correct |
6 ms |
2964 KB |
Output is correct |
128 |
Correct |
6 ms |
3000 KB |
Output is correct |
129 |
Correct |
6 ms |
3000 KB |
Output is correct |
130 |
Correct |
13 ms |
5228 KB |
Output is correct |
131 |
Correct |
10 ms |
4280 KB |
Output is correct |
132 |
Correct |
5 ms |
2396 KB |
Output is correct |
133 |
Correct |
11 ms |
4460 KB |
Output is correct |
134 |
Correct |
2 ms |
1628 KB |
Output is correct |
135 |
Correct |
2 ms |
1112 KB |
Output is correct |
136 |
Correct |
5 ms |
2392 KB |
Output is correct |
137 |
Correct |
6 ms |
2604 KB |
Output is correct |
138 |
Correct |
2 ms |
1116 KB |
Output is correct |
139 |
Correct |
5 ms |
2600 KB |
Output is correct |
140 |
Correct |
5 ms |
2596 KB |
Output is correct |
141 |
Correct |
2 ms |
1116 KB |
Output is correct |
142 |
Correct |
5 ms |
2396 KB |
Output is correct |
143 |
Correct |
6 ms |
2396 KB |
Output is correct |
144 |
Correct |
1 ms |
348 KB |
Output is correct |
145 |
Correct |
6 ms |
2592 KB |
Output is correct |
146 |
Correct |
6 ms |
2396 KB |
Output is correct |
147 |
Correct |
18 ms |
7200 KB |
Output is correct |
148 |
Correct |
26 ms |
7376 KB |
Output is correct |
149 |
Correct |
17 ms |
7120 KB |
Output is correct |
150 |
Correct |
18 ms |
7888 KB |
Output is correct |
151 |
Correct |
23 ms |
7880 KB |
Output is correct |
152 |
Correct |
32 ms |
7888 KB |
Output is correct |
153 |
Correct |
20 ms |
7888 KB |
Output is correct |
154 |
Correct |
18 ms |
7788 KB |
Output is correct |
155 |
Correct |
19 ms |
7888 KB |
Output is correct |
156 |
Correct |
20 ms |
8008 KB |
Output is correct |
157 |
Correct |
19 ms |
7888 KB |
Output is correct |
158 |
Correct |
20 ms |
7920 KB |
Output is correct |
159 |
Correct |
20 ms |
7884 KB |
Output is correct |
160 |
Correct |
22 ms |
7888 KB |
Output is correct |
161 |
Correct |
19 ms |
7796 KB |
Output is correct |
162 |
Correct |
16 ms |
7020 KB |
Output is correct |
163 |
Correct |
18 ms |
7196 KB |
Output is correct |
164 |
Correct |
6 ms |
2904 KB |
Output is correct |
165 |
Correct |
27 ms |
7112 KB |
Output is correct |
166 |
Correct |
13 ms |
5484 KB |
Output is correct |
167 |
Correct |
17 ms |
7120 KB |
Output is correct |
168 |
Correct |
4 ms |
2396 KB |
Output is correct |
169 |
Correct |
9 ms |
4020 KB |
Output is correct |
170 |
Correct |
9 ms |
3852 KB |
Output is correct |
171 |
Correct |
8 ms |
3768 KB |
Output is correct |
172 |
Correct |
13 ms |
3720 KB |
Output is correct |
173 |
Correct |
8 ms |
4020 KB |
Output is correct |
174 |
Correct |
10 ms |
4024 KB |
Output is correct |
175 |
Correct |
9 ms |
3976 KB |
Output is correct |
176 |
Correct |
9 ms |
4024 KB |
Output is correct |
177 |
Correct |
8 ms |
3680 KB |
Output is correct |
178 |
Correct |
3 ms |
2140 KB |
Output is correct |
179 |
Correct |
22 ms |
10076 KB |
Output is correct |
180 |
Correct |
90 ms |
36188 KB |
Output is correct |
181 |
Correct |
91 ms |
36188 KB |
Output is correct |
182 |
Correct |
22 ms |
9816 KB |
Output is correct |
183 |
Correct |
94 ms |
36188 KB |
Output is correct |
184 |
Correct |
88 ms |
36184 KB |
Output is correct |
185 |
Correct |
66 ms |
26716 KB |
Output is correct |
186 |
Correct |
90 ms |
36188 KB |
Output is correct |
187 |
Correct |
92 ms |
36184 KB |
Output is correct |
188 |
Correct |
49 ms |
19032 KB |
Output is correct |
189 |
Correct |
94 ms |
36340 KB |
Output is correct |
190 |
Correct |
103 ms |
36184 KB |
Output is correct |
191 |
Correct |
516 ms |
112652 KB |
Output is correct |
192 |
Correct |
499 ms |
119480 KB |
Output is correct |
193 |
Correct |
503 ms |
116152 KB |
Output is correct |
194 |
Correct |
460 ms |
129640 KB |
Output is correct |
195 |
Correct |
408 ms |
129724 KB |
Output is correct |
196 |
Correct |
459 ms |
129812 KB |
Output is correct |
197 |
Correct |
446 ms |
129668 KB |
Output is correct |
198 |
Correct |
421 ms |
129672 KB |
Output is correct |
199 |
Correct |
441 ms |
129640 KB |
Output is correct |
200 |
Correct |
486 ms |
129576 KB |
Output is correct |
201 |
Correct |
493 ms |
129804 KB |
Output is correct |
202 |
Correct |
464 ms |
129596 KB |
Output is correct |
203 |
Correct |
445 ms |
129580 KB |
Output is correct |
204 |
Correct |
439 ms |
129708 KB |
Output is correct |
205 |
Correct |
435 ms |
129720 KB |
Output is correct |
206 |
Correct |
245 ms |
81144 KB |
Output is correct |
207 |
Correct |
358 ms |
117172 KB |
Output is correct |
208 |
Correct |
285 ms |
87092 KB |
Output is correct |
209 |
Correct |
375 ms |
118664 KB |
Output is correct |
210 |
Correct |
361 ms |
116160 KB |
Output is correct |
211 |
Correct |
89 ms |
35552 KB |
Output is correct |
212 |
Correct |
83 ms |
31324 KB |
Output is correct |
213 |
Correct |
168 ms |
59580 KB |
Output is correct |
214 |
Correct |
180 ms |
56504 KB |
Output is correct |
215 |
Correct |
169 ms |
60600 KB |
Output is correct |
216 |
Correct |
156 ms |
55748 KB |
Output is correct |
217 |
Correct |
153 ms |
56508 KB |
Output is correct |
218 |
Correct |
114 ms |
42180 KB |
Output is correct |
219 |
Correct |
210 ms |
60812 KB |
Output is correct |
220 |
Correct |
495 ms |
121524 KB |
Output is correct |
221 |
Correct |
381 ms |
91644 KB |
Output is correct |
222 |
Correct |
66 ms |
30588 KB |
Output is correct |