답안 #1080546

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1080546 2024-08-29T10:51:46 Z TAhmed33 Maze (JOI23_ho_t3) C++
100 / 100
790 ms 96036 KB
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("Ofast")
typedef long long ll;
const int inf = 1e9;
int n, m, K;
pair <int, int> s, g;
vector <vector <char>> a;
vector <vector <bool>> vis;
vector <vector <int>> dist;
int dx[4] = {0, -1, 0, 1};
int dy[4] = {1, 0, -1, 0};
bool valid (int x, int y) {
	return x >= 0 && x < n && y >= 0 && y < m && !vis[x][y];
}
void solve () {
	cin >> n >> m >> K;
	cin >> s.first >> s.second;
	cin >> g.first >> g.second;
	s.first--; s.second--; g.first--; g.second--;
	a.resize(n, vector <char> (m));
	vis.resize(n, vector <bool> (m, false));
	dist.resize(n, vector <int> (m, inf));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
			vis[i][j] = 0;
		}
	}
	vis[s.first][s.second] = 1; 
	dist[s.first][s.second] = 0;
	deque <pair <int, int>> cur;
	cur.push_back(s);
	int rem = n * m - 1;
	int ss = 0;
	while (rem > 0) {
/*		cout << rem << '\n';
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				cout << vis[i][j];
			}
			cout << '\n';
		}
		cout << '\n';*/
		if (cur.empty()) {
			break;
		}
		deque <array <int, 4>> dd;
		while (!cur.empty()) {
			auto k = cur.front();
			cur.pop_front();
			//cout << k.first << " " << k.second << '\n';
			bool flag = 0;
			for (int i = 0; i < 4; i++) {
				int x = k.first + dx[i];
				int y = k.second + dy[i];
				if (!valid(x, y)) {
					continue;
				}
				if (a[x][y] == '.') {
					dist[x][y] = ss;
					vis[x][y] = 1;
					cur.push_back({x, y});
					rem--;
				} else {
					flag = 1;
				}
			}
			if (flag) {
				dd.push_back({k.first, k.second, 0, 0});
			}
		}
		ss++;
		while (!dd.empty()) {
			auto k = dd.front();
			dd.pop_front();
			bool flag = 0;
			for (int i = 0; i < 4; i++) {
				array <int, 4> g = {k[0] + dx[i], k[1] + dy[i], k[2] + abs(dx[i]), k[3] + abs(dy[i])};
/*				for (auto j : k) cout << j << " ";
				cout << '\n';
				cout << ": \n";
				for (auto k : g) {
					cout << k << " ";
				}
				cout << '\n' << '\n';*/
				if (valid(g[0], g[1]) && g[2] <= K && g[3] <= K && g[2] + g[3] < 2 * K) {
					vis[g[0]][g[1]] = 1;
					dist[g[0]][g[1]] = ss;
					dd.push_back(g);
					rem--;
				}
			}
			if (!flag) {
				cur.push_back({k[0], k[1]});
			}
		}
	}	
	cout << dist[g.first][g.second] << '\n';
}				
signed main () {
	 #ifndef ONLINE_JUDGE 
		//freopen("input_file", "r", stdin);
		//freopen("output_file", "w", stdout);
	#endif
	//ios::sync_with_stdio(0); cin.tie(0);
	int tc = 1; //cin >> tc;
	while (tc--) solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 428 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 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 440 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 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 6 ms 604 KB Output is correct
20 Correct 4 ms 860 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 8 ms 856 KB Output is correct
23 Correct 7 ms 604 KB Output is correct
24 Correct 3 ms 860 KB Output is correct
25 Correct 7 ms 860 KB Output is correct
26 Correct 6 ms 860 KB Output is correct
27 Correct 6 ms 884 KB Output is correct
28 Correct 6 ms 604 KB Output is correct
29 Correct 16 ms 1372 KB Output is correct
30 Correct 6 ms 860 KB Output is correct
31 Correct 6 ms 1384 KB Output is correct
32 Correct 15 ms 1344 KB Output is correct
33 Correct 15 ms 1368 KB Output is correct
34 Correct 6 ms 1732 KB Output is correct
35 Correct 13 ms 1736 KB Output is correct
36 Correct 16 ms 1372 KB Output is correct
37 Correct 16 ms 1508 KB Output is correct
38 Correct 15 ms 1424 KB Output is correct
39 Correct 163 ms 9404 KB Output is correct
40 Correct 23 ms 1368 KB Output is correct
41 Correct 10 ms 1956 KB Output is correct
42 Correct 25 ms 1628 KB Output is correct
43 Correct 20 ms 2140 KB Output is correct
44 Correct 63 ms 4728 KB Output is correct
45 Correct 100 ms 5188 KB Output is correct
46 Correct 93 ms 10580 KB Output is correct
47 Correct 165 ms 9556 KB Output is correct
48 Correct 157 ms 9556 KB Output is correct
49 Correct 68 ms 13980 KB Output is correct
50 Correct 130 ms 13984 KB Output is correct
51 Correct 173 ms 10280 KB Output is correct
52 Correct 176 ms 9812 KB Output is correct
53 Correct 184 ms 9640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 604 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 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 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 600 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 508 KB Output is correct
20 Correct 1 ms 344 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 432 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 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 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 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 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 3 ms 604 KB Output is correct
26 Correct 4 ms 1116 KB Output is correct
27 Correct 3 ms 824 KB Output is correct
28 Correct 3 ms 860 KB Output is correct
29 Correct 6 ms 1116 KB Output is correct
30 Correct 4 ms 1112 KB Output is correct
31 Correct 4 ms 604 KB Output is correct
32 Correct 7 ms 856 KB Output is correct
33 Correct 7 ms 888 KB Output is correct
34 Correct 9 ms 2136 KB Output is correct
35 Correct 7 ms 1388 KB Output is correct
36 Correct 7 ms 1368 KB Output is correct
37 Correct 8 ms 2396 KB Output is correct
38 Correct 14 ms 2396 KB Output is correct
39 Correct 53 ms 6940 KB Output is correct
40 Correct 100 ms 19172 KB Output is correct
41 Correct 93 ms 10408 KB Output is correct
42 Correct 68 ms 10320 KB Output is correct
43 Correct 77 ms 21732 KB Output is correct
44 Correct 84 ms 21688 KB Output is correct
45 Correct 131 ms 23552 KB Output is correct
46 Correct 128 ms 23952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 604 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 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 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 600 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 508 KB Output is correct
20 Correct 1 ms 344 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 432 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 432 KB Output is correct
33 Correct 6 ms 604 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 436 KB Output is correct
36 Correct 3 ms 604 KB Output is correct
37 Correct 4 ms 860 KB Output is correct
38 Correct 5 ms 1024 KB Output is correct
39 Correct 5 ms 860 KB Output is correct
40 Correct 6 ms 604 KB Output is correct
41 Correct 10 ms 604 KB Output is correct
42 Correct 6 ms 840 KB Output is correct
43 Correct 4 ms 1116 KB Output is correct
44 Correct 3 ms 1116 KB Output is correct
45 Correct 4 ms 860 KB Output is correct
46 Correct 9 ms 860 KB Output is correct
47 Correct 4 ms 860 KB Output is correct
48 Correct 4 ms 604 KB Output is correct
49 Correct 4 ms 604 KB Output is correct
50 Correct 5 ms 604 KB Output is correct
51 Correct 4 ms 832 KB Output is correct
52 Correct 6 ms 704 KB Output is correct
53 Correct 6 ms 860 KB Output is correct
54 Correct 6 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 604 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 348 KB Output is correct
7 Correct 1 ms 604 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 344 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 600 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 508 KB Output is correct
20 Correct 1 ms 344 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 432 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 432 KB Output is correct
33 Correct 6 ms 604 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 436 KB Output is correct
36 Correct 3 ms 604 KB Output is correct
37 Correct 4 ms 860 KB Output is correct
38 Correct 5 ms 1024 KB Output is correct
39 Correct 5 ms 860 KB Output is correct
40 Correct 6 ms 604 KB Output is correct
41 Correct 10 ms 604 KB Output is correct
42 Correct 6 ms 840 KB Output is correct
43 Correct 4 ms 1116 KB Output is correct
44 Correct 3 ms 1116 KB Output is correct
45 Correct 4 ms 860 KB Output is correct
46 Correct 9 ms 860 KB Output is correct
47 Correct 4 ms 860 KB Output is correct
48 Correct 4 ms 604 KB Output is correct
49 Correct 4 ms 604 KB Output is correct
50 Correct 5 ms 604 KB Output is correct
51 Correct 4 ms 832 KB Output is correct
52 Correct 6 ms 704 KB Output is correct
53 Correct 6 ms 860 KB Output is correct
54 Correct 6 ms 856 KB Output is correct
55 Correct 16 ms 1372 KB Output is correct
56 Correct 6 ms 860 KB Output is correct
57 Correct 11 ms 2164 KB Output is correct
58 Correct 19 ms 1116 KB Output is correct
59 Correct 7 ms 1368 KB Output is correct
60 Correct 16 ms 1368 KB Output is correct
61 Correct 25 ms 1372 KB Output is correct
62 Correct 7 ms 1372 KB Output is correct
63 Correct 14 ms 2396 KB Output is correct
64 Correct 15 ms 2396 KB Output is correct
65 Correct 7 ms 1736 KB Output is correct
66 Correct 14 ms 1736 KB Output is correct
67 Correct 10 ms 1408 KB Output is correct
68 Correct 9 ms 1112 KB Output is correct
69 Correct 10 ms 1112 KB Output is correct
70 Correct 10 ms 1368 KB Output is correct
71 Correct 15 ms 1372 KB Output is correct
72 Correct 16 ms 1388 KB Output is correct
73 Correct 17 ms 1372 KB Output is correct
74 Correct 18 ms 1384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 428 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 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 440 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 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 6 ms 604 KB Output is correct
20 Correct 4 ms 860 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 8 ms 856 KB Output is correct
23 Correct 7 ms 604 KB Output is correct
24 Correct 3 ms 860 KB Output is correct
25 Correct 7 ms 860 KB Output is correct
26 Correct 6 ms 860 KB Output is correct
27 Correct 6 ms 884 KB Output is correct
28 Correct 6 ms 604 KB Output is correct
29 Correct 16 ms 1372 KB Output is correct
30 Correct 6 ms 860 KB Output is correct
31 Correct 6 ms 1384 KB Output is correct
32 Correct 15 ms 1344 KB Output is correct
33 Correct 15 ms 1368 KB Output is correct
34 Correct 6 ms 1732 KB Output is correct
35 Correct 13 ms 1736 KB Output is correct
36 Correct 16 ms 1372 KB Output is correct
37 Correct 16 ms 1508 KB Output is correct
38 Correct 15 ms 1424 KB Output is correct
39 Correct 163 ms 9404 KB Output is correct
40 Correct 23 ms 1368 KB Output is correct
41 Correct 10 ms 1956 KB Output is correct
42 Correct 25 ms 1628 KB Output is correct
43 Correct 20 ms 2140 KB Output is correct
44 Correct 63 ms 4728 KB Output is correct
45 Correct 100 ms 5188 KB Output is correct
46 Correct 93 ms 10580 KB Output is correct
47 Correct 165 ms 9556 KB Output is correct
48 Correct 157 ms 9556 KB Output is correct
49 Correct 68 ms 13980 KB Output is correct
50 Correct 130 ms 13984 KB Output is correct
51 Correct 173 ms 10280 KB Output is correct
52 Correct 176 ms 9812 KB Output is correct
53 Correct 184 ms 9640 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 604 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 0 ms 348 KB Output is correct
60 Correct 1 ms 604 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 344 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 600 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 1 ms 604 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 0 ms 508 KB Output is correct
73 Correct 1 ms 344 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 1 ms 432 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 1 ms 344 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 432 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 344 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 0 ms 348 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 1 ms 348 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 1 ms 348 KB Output is correct
99 Correct 0 ms 348 KB Output is correct
100 Correct 0 ms 344 KB Output is correct
101 Correct 1 ms 344 KB Output is correct
102 Correct 1 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 1 ms 348 KB Output is correct
108 Correct 1 ms 348 KB Output is correct
109 Correct 1 ms 348 KB Output is correct
110 Correct 3 ms 604 KB Output is correct
111 Correct 4 ms 1116 KB Output is correct
112 Correct 3 ms 824 KB Output is correct
113 Correct 3 ms 860 KB Output is correct
114 Correct 6 ms 1116 KB Output is correct
115 Correct 4 ms 1112 KB Output is correct
116 Correct 4 ms 604 KB Output is correct
117 Correct 7 ms 856 KB Output is correct
118 Correct 7 ms 888 KB Output is correct
119 Correct 9 ms 2136 KB Output is correct
120 Correct 7 ms 1388 KB Output is correct
121 Correct 7 ms 1368 KB Output is correct
122 Correct 8 ms 2396 KB Output is correct
123 Correct 14 ms 2396 KB Output is correct
124 Correct 53 ms 6940 KB Output is correct
125 Correct 100 ms 19172 KB Output is correct
126 Correct 93 ms 10408 KB Output is correct
127 Correct 68 ms 10320 KB Output is correct
128 Correct 77 ms 21732 KB Output is correct
129 Correct 84 ms 21688 KB Output is correct
130 Correct 131 ms 23552 KB Output is correct
131 Correct 128 ms 23952 KB Output is correct
132 Correct 6 ms 604 KB Output is correct
133 Correct 1 ms 348 KB Output is correct
134 Correct 1 ms 436 KB Output is correct
135 Correct 3 ms 604 KB Output is correct
136 Correct 4 ms 860 KB Output is correct
137 Correct 5 ms 1024 KB Output is correct
138 Correct 5 ms 860 KB Output is correct
139 Correct 6 ms 604 KB Output is correct
140 Correct 10 ms 604 KB Output is correct
141 Correct 6 ms 840 KB Output is correct
142 Correct 4 ms 1116 KB Output is correct
143 Correct 3 ms 1116 KB Output is correct
144 Correct 4 ms 860 KB Output is correct
145 Correct 9 ms 860 KB Output is correct
146 Correct 4 ms 860 KB Output is correct
147 Correct 4 ms 604 KB Output is correct
148 Correct 4 ms 604 KB Output is correct
149 Correct 5 ms 604 KB Output is correct
150 Correct 4 ms 832 KB Output is correct
151 Correct 6 ms 704 KB Output is correct
152 Correct 6 ms 860 KB Output is correct
153 Correct 6 ms 856 KB Output is correct
154 Correct 16 ms 1372 KB Output is correct
155 Correct 6 ms 860 KB Output is correct
156 Correct 11 ms 2164 KB Output is correct
157 Correct 19 ms 1116 KB Output is correct
158 Correct 7 ms 1368 KB Output is correct
159 Correct 16 ms 1368 KB Output is correct
160 Correct 25 ms 1372 KB Output is correct
161 Correct 7 ms 1372 KB Output is correct
162 Correct 14 ms 2396 KB Output is correct
163 Correct 15 ms 2396 KB Output is correct
164 Correct 7 ms 1736 KB Output is correct
165 Correct 14 ms 1736 KB Output is correct
166 Correct 10 ms 1408 KB Output is correct
167 Correct 9 ms 1112 KB Output is correct
168 Correct 10 ms 1112 KB Output is correct
169 Correct 10 ms 1368 KB Output is correct
170 Correct 15 ms 1372 KB Output is correct
171 Correct 16 ms 1388 KB Output is correct
172 Correct 17 ms 1372 KB Output is correct
173 Correct 18 ms 1384 KB Output is correct
174 Correct 16 ms 1628 KB Output is correct
175 Correct 26 ms 2396 KB Output is correct
176 Correct 62 ms 5212 KB Output is correct
177 Correct 108 ms 6300 KB Output is correct
178 Correct 95 ms 8344 KB Output is correct
179 Correct 101 ms 9528 KB Output is correct
180 Correct 99 ms 9300 KB Output is correct
181 Correct 91 ms 9536 KB Output is correct
182 Correct 95 ms 9972 KB Output is correct
183 Correct 119 ms 11532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 428 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 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 440 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 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 6 ms 604 KB Output is correct
20 Correct 4 ms 860 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 8 ms 856 KB Output is correct
23 Correct 7 ms 604 KB Output is correct
24 Correct 3 ms 860 KB Output is correct
25 Correct 7 ms 860 KB Output is correct
26 Correct 6 ms 860 KB Output is correct
27 Correct 6 ms 884 KB Output is correct
28 Correct 6 ms 604 KB Output is correct
29 Correct 16 ms 1372 KB Output is correct
30 Correct 6 ms 860 KB Output is correct
31 Correct 6 ms 1384 KB Output is correct
32 Correct 15 ms 1344 KB Output is correct
33 Correct 15 ms 1368 KB Output is correct
34 Correct 6 ms 1732 KB Output is correct
35 Correct 13 ms 1736 KB Output is correct
36 Correct 16 ms 1372 KB Output is correct
37 Correct 16 ms 1508 KB Output is correct
38 Correct 15 ms 1424 KB Output is correct
39 Correct 163 ms 9404 KB Output is correct
40 Correct 23 ms 1368 KB Output is correct
41 Correct 10 ms 1956 KB Output is correct
42 Correct 25 ms 1628 KB Output is correct
43 Correct 20 ms 2140 KB Output is correct
44 Correct 63 ms 4728 KB Output is correct
45 Correct 100 ms 5188 KB Output is correct
46 Correct 93 ms 10580 KB Output is correct
47 Correct 165 ms 9556 KB Output is correct
48 Correct 157 ms 9556 KB Output is correct
49 Correct 68 ms 13980 KB Output is correct
50 Correct 130 ms 13984 KB Output is correct
51 Correct 173 ms 10280 KB Output is correct
52 Correct 176 ms 9812 KB Output is correct
53 Correct 184 ms 9640 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 604 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 0 ms 348 KB Output is correct
60 Correct 1 ms 604 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 344 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 600 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 1 ms 604 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 0 ms 508 KB Output is correct
73 Correct 1 ms 344 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 1 ms 432 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 1 ms 344 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 432 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 344 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 0 ms 348 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 1 ms 348 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 1 ms 348 KB Output is correct
99 Correct 0 ms 348 KB Output is correct
100 Correct 0 ms 344 KB Output is correct
101 Correct 1 ms 344 KB Output is correct
102 Correct 1 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 1 ms 348 KB Output is correct
108 Correct 1 ms 348 KB Output is correct
109 Correct 1 ms 348 KB Output is correct
110 Correct 3 ms 604 KB Output is correct
111 Correct 4 ms 1116 KB Output is correct
112 Correct 3 ms 824 KB Output is correct
113 Correct 3 ms 860 KB Output is correct
114 Correct 6 ms 1116 KB Output is correct
115 Correct 4 ms 1112 KB Output is correct
116 Correct 4 ms 604 KB Output is correct
117 Correct 7 ms 856 KB Output is correct
118 Correct 7 ms 888 KB Output is correct
119 Correct 9 ms 2136 KB Output is correct
120 Correct 7 ms 1388 KB Output is correct
121 Correct 7 ms 1368 KB Output is correct
122 Correct 8 ms 2396 KB Output is correct
123 Correct 14 ms 2396 KB Output is correct
124 Correct 53 ms 6940 KB Output is correct
125 Correct 100 ms 19172 KB Output is correct
126 Correct 93 ms 10408 KB Output is correct
127 Correct 68 ms 10320 KB Output is correct
128 Correct 77 ms 21732 KB Output is correct
129 Correct 84 ms 21688 KB Output is correct
130 Correct 131 ms 23552 KB Output is correct
131 Correct 128 ms 23952 KB Output is correct
132 Correct 6 ms 604 KB Output is correct
133 Correct 1 ms 348 KB Output is correct
134 Correct 1 ms 436 KB Output is correct
135 Correct 3 ms 604 KB Output is correct
136 Correct 4 ms 860 KB Output is correct
137 Correct 5 ms 1024 KB Output is correct
138 Correct 5 ms 860 KB Output is correct
139 Correct 6 ms 604 KB Output is correct
140 Correct 10 ms 604 KB Output is correct
141 Correct 6 ms 840 KB Output is correct
142 Correct 4 ms 1116 KB Output is correct
143 Correct 3 ms 1116 KB Output is correct
144 Correct 4 ms 860 KB Output is correct
145 Correct 9 ms 860 KB Output is correct
146 Correct 4 ms 860 KB Output is correct
147 Correct 4 ms 604 KB Output is correct
148 Correct 4 ms 604 KB Output is correct
149 Correct 5 ms 604 KB Output is correct
150 Correct 4 ms 832 KB Output is correct
151 Correct 6 ms 704 KB Output is correct
152 Correct 6 ms 860 KB Output is correct
153 Correct 6 ms 856 KB Output is correct
154 Correct 16 ms 1372 KB Output is correct
155 Correct 6 ms 860 KB Output is correct
156 Correct 11 ms 2164 KB Output is correct
157 Correct 19 ms 1116 KB Output is correct
158 Correct 7 ms 1368 KB Output is correct
159 Correct 16 ms 1368 KB Output is correct
160 Correct 25 ms 1372 KB Output is correct
161 Correct 7 ms 1372 KB Output is correct
162 Correct 14 ms 2396 KB Output is correct
163 Correct 15 ms 2396 KB Output is correct
164 Correct 7 ms 1736 KB Output is correct
165 Correct 14 ms 1736 KB Output is correct
166 Correct 10 ms 1408 KB Output is correct
167 Correct 9 ms 1112 KB Output is correct
168 Correct 10 ms 1112 KB Output is correct
169 Correct 10 ms 1368 KB Output is correct
170 Correct 15 ms 1372 KB Output is correct
171 Correct 16 ms 1388 KB Output is correct
172 Correct 17 ms 1372 KB Output is correct
173 Correct 18 ms 1384 KB Output is correct
174 Correct 16 ms 1628 KB Output is correct
175 Correct 26 ms 2396 KB Output is correct
176 Correct 62 ms 5212 KB Output is correct
177 Correct 108 ms 6300 KB Output is correct
178 Correct 95 ms 8344 KB Output is correct
179 Correct 101 ms 9528 KB Output is correct
180 Correct 99 ms 9300 KB Output is correct
181 Correct 91 ms 9536 KB Output is correct
182 Correct 95 ms 9972 KB Output is correct
183 Correct 119 ms 11532 KB Output is correct
184 Correct 359 ms 18688 KB Output is correct
185 Correct 120 ms 10388 KB Output is correct
186 Correct 146 ms 25668 KB Output is correct
187 Correct 138 ms 14152 KB Output is correct
188 Correct 138 ms 20436 KB Output is correct
189 Correct 356 ms 18880 KB Output is correct
190 Correct 312 ms 18516 KB Output is correct
191 Correct 138 ms 20564 KB Output is correct
192 Correct 171 ms 43012 KB Output is correct
193 Correct 173 ms 43116 KB Output is correct
194 Correct 125 ms 27368 KB Output is correct
195 Correct 300 ms 27624 KB Output is correct
196 Correct 180 ms 18388 KB Output is correct
197 Correct 173 ms 18564 KB Output is correct
198 Correct 188 ms 18768 KB Output is correct
199 Correct 186 ms 19280 KB Output is correct
200 Correct 317 ms 19540 KB Output is correct
201 Correct 403 ms 19112 KB Output is correct
202 Correct 378 ms 18768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 428 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 1 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 440 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 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 6 ms 604 KB Output is correct
20 Correct 4 ms 860 KB Output is correct
21 Correct 3 ms 860 KB Output is correct
22 Correct 8 ms 856 KB Output is correct
23 Correct 7 ms 604 KB Output is correct
24 Correct 3 ms 860 KB Output is correct
25 Correct 7 ms 860 KB Output is correct
26 Correct 6 ms 860 KB Output is correct
27 Correct 6 ms 884 KB Output is correct
28 Correct 6 ms 604 KB Output is correct
29 Correct 16 ms 1372 KB Output is correct
30 Correct 6 ms 860 KB Output is correct
31 Correct 6 ms 1384 KB Output is correct
32 Correct 15 ms 1344 KB Output is correct
33 Correct 15 ms 1368 KB Output is correct
34 Correct 6 ms 1732 KB Output is correct
35 Correct 13 ms 1736 KB Output is correct
36 Correct 16 ms 1372 KB Output is correct
37 Correct 16 ms 1508 KB Output is correct
38 Correct 15 ms 1424 KB Output is correct
39 Correct 163 ms 9404 KB Output is correct
40 Correct 23 ms 1368 KB Output is correct
41 Correct 10 ms 1956 KB Output is correct
42 Correct 25 ms 1628 KB Output is correct
43 Correct 20 ms 2140 KB Output is correct
44 Correct 63 ms 4728 KB Output is correct
45 Correct 100 ms 5188 KB Output is correct
46 Correct 93 ms 10580 KB Output is correct
47 Correct 165 ms 9556 KB Output is correct
48 Correct 157 ms 9556 KB Output is correct
49 Correct 68 ms 13980 KB Output is correct
50 Correct 130 ms 13984 KB Output is correct
51 Correct 173 ms 10280 KB Output is correct
52 Correct 176 ms 9812 KB Output is correct
53 Correct 184 ms 9640 KB Output is correct
54 Correct 1 ms 348 KB Output is correct
55 Correct 1 ms 604 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 0 ms 348 KB Output is correct
60 Correct 1 ms 604 KB Output is correct
61 Correct 0 ms 348 KB Output is correct
62 Correct 1 ms 344 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 600 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 1 ms 604 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 1 ms 348 KB Output is correct
72 Correct 0 ms 508 KB Output is correct
73 Correct 1 ms 344 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 0 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 1 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 1 ms 432 KB Output is correct
80 Correct 1 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 1 ms 344 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 0 ms 348 KB Output is correct
85 Correct 0 ms 432 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 344 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 1 ms 348 KB Output is correct
92 Correct 1 ms 348 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 0 ms 348 KB Output is correct
95 Correct 0 ms 348 KB Output is correct
96 Correct 1 ms 348 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 1 ms 348 KB Output is correct
99 Correct 0 ms 348 KB Output is correct
100 Correct 0 ms 344 KB Output is correct
101 Correct 1 ms 344 KB Output is correct
102 Correct 1 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 348 KB Output is correct
107 Correct 1 ms 348 KB Output is correct
108 Correct 1 ms 348 KB Output is correct
109 Correct 1 ms 348 KB Output is correct
110 Correct 3 ms 604 KB Output is correct
111 Correct 4 ms 1116 KB Output is correct
112 Correct 3 ms 824 KB Output is correct
113 Correct 3 ms 860 KB Output is correct
114 Correct 6 ms 1116 KB Output is correct
115 Correct 4 ms 1112 KB Output is correct
116 Correct 4 ms 604 KB Output is correct
117 Correct 7 ms 856 KB Output is correct
118 Correct 7 ms 888 KB Output is correct
119 Correct 9 ms 2136 KB Output is correct
120 Correct 7 ms 1388 KB Output is correct
121 Correct 7 ms 1368 KB Output is correct
122 Correct 8 ms 2396 KB Output is correct
123 Correct 14 ms 2396 KB Output is correct
124 Correct 53 ms 6940 KB Output is correct
125 Correct 100 ms 19172 KB Output is correct
126 Correct 93 ms 10408 KB Output is correct
127 Correct 68 ms 10320 KB Output is correct
128 Correct 77 ms 21732 KB Output is correct
129 Correct 84 ms 21688 KB Output is correct
130 Correct 131 ms 23552 KB Output is correct
131 Correct 128 ms 23952 KB Output is correct
132 Correct 6 ms 604 KB Output is correct
133 Correct 1 ms 348 KB Output is correct
134 Correct 1 ms 436 KB Output is correct
135 Correct 3 ms 604 KB Output is correct
136 Correct 4 ms 860 KB Output is correct
137 Correct 5 ms 1024 KB Output is correct
138 Correct 5 ms 860 KB Output is correct
139 Correct 6 ms 604 KB Output is correct
140 Correct 10 ms 604 KB Output is correct
141 Correct 6 ms 840 KB Output is correct
142 Correct 4 ms 1116 KB Output is correct
143 Correct 3 ms 1116 KB Output is correct
144 Correct 4 ms 860 KB Output is correct
145 Correct 9 ms 860 KB Output is correct
146 Correct 4 ms 860 KB Output is correct
147 Correct 4 ms 604 KB Output is correct
148 Correct 4 ms 604 KB Output is correct
149 Correct 5 ms 604 KB Output is correct
150 Correct 4 ms 832 KB Output is correct
151 Correct 6 ms 704 KB Output is correct
152 Correct 6 ms 860 KB Output is correct
153 Correct 6 ms 856 KB Output is correct
154 Correct 16 ms 1372 KB Output is correct
155 Correct 6 ms 860 KB Output is correct
156 Correct 11 ms 2164 KB Output is correct
157 Correct 19 ms 1116 KB Output is correct
158 Correct 7 ms 1368 KB Output is correct
159 Correct 16 ms 1368 KB Output is correct
160 Correct 25 ms 1372 KB Output is correct
161 Correct 7 ms 1372 KB Output is correct
162 Correct 14 ms 2396 KB Output is correct
163 Correct 15 ms 2396 KB Output is correct
164 Correct 7 ms 1736 KB Output is correct
165 Correct 14 ms 1736 KB Output is correct
166 Correct 10 ms 1408 KB Output is correct
167 Correct 9 ms 1112 KB Output is correct
168 Correct 10 ms 1112 KB Output is correct
169 Correct 10 ms 1368 KB Output is correct
170 Correct 15 ms 1372 KB Output is correct
171 Correct 16 ms 1388 KB Output is correct
172 Correct 17 ms 1372 KB Output is correct
173 Correct 18 ms 1384 KB Output is correct
174 Correct 16 ms 1628 KB Output is correct
175 Correct 26 ms 2396 KB Output is correct
176 Correct 62 ms 5212 KB Output is correct
177 Correct 108 ms 6300 KB Output is correct
178 Correct 95 ms 8344 KB Output is correct
179 Correct 101 ms 9528 KB Output is correct
180 Correct 99 ms 9300 KB Output is correct
181 Correct 91 ms 9536 KB Output is correct
182 Correct 95 ms 9972 KB Output is correct
183 Correct 119 ms 11532 KB Output is correct
184 Correct 359 ms 18688 KB Output is correct
185 Correct 120 ms 10388 KB Output is correct
186 Correct 146 ms 25668 KB Output is correct
187 Correct 138 ms 14152 KB Output is correct
188 Correct 138 ms 20436 KB Output is correct
189 Correct 356 ms 18880 KB Output is correct
190 Correct 312 ms 18516 KB Output is correct
191 Correct 138 ms 20564 KB Output is correct
192 Correct 171 ms 43012 KB Output is correct
193 Correct 173 ms 43116 KB Output is correct
194 Correct 125 ms 27368 KB Output is correct
195 Correct 300 ms 27624 KB Output is correct
196 Correct 180 ms 18388 KB Output is correct
197 Correct 173 ms 18564 KB Output is correct
198 Correct 188 ms 18768 KB Output is correct
199 Correct 186 ms 19280 KB Output is correct
200 Correct 317 ms 19540 KB Output is correct
201 Correct 403 ms 19112 KB Output is correct
202 Correct 378 ms 18768 KB Output is correct
203 Correct 746 ms 36684 KB Output is correct
204 Correct 180 ms 21816 KB Output is correct
205 Correct 333 ms 22608 KB Output is correct
206 Correct 659 ms 36380 KB Output is correct
207 Correct 313 ms 40624 KB Output is correct
208 Correct 790 ms 36808 KB Output is correct
209 Correct 719 ms 36684 KB Output is correct
210 Correct 314 ms 40544 KB Output is correct
211 Correct 313 ms 85848 KB Output is correct
212 Correct 414 ms 85708 KB Output is correct
213 Correct 260 ms 54692 KB Output is correct
214 Correct 510 ms 54648 KB Output is correct
215 Correct 353 ms 36468 KB Output is correct
216 Correct 354 ms 36920 KB Output is correct
217 Correct 364 ms 37244 KB Output is correct
218 Correct 380 ms 37716 KB Output is correct
219 Correct 495 ms 55284 KB Output is correct
220 Correct 510 ms 72692 KB Output is correct
221 Correct 498 ms 94704 KB Output is correct
222 Correct 510 ms 96036 KB Output is correct
223 Correct 666 ms 38084 KB Output is correct
224 Correct 742 ms 37472 KB Output is correct
225 Correct 780 ms 36928 KB Output is correct