답안 #924298

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
924298 2024-02-08T19:40:09 Z vjudge1 Maze (JOI23_ho_t3) C++17
94 / 100
2000 ms 130984 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

using namespace std;

int R, C, N;

bool isBest(int d1, int d2, pair<int, int>& p){
	int mn1 = min(d1, d2);
	int mx1 = max(d1, d2);
	int mn2 = min(p.first, p.second);
	int mx2 = max(p.first, p.second);
	if(!((mx1 <= N && mn1 < N) || (mx2 <= N && mn2 < N))) return false;
	if(mx1 == mx2) return mn1 < mn2;
	else return mx1 < mx2;
}

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

	cin >> R >> C >> N;
	int Sr, Sc, Gr, Gc; cin >> Sr >> Sc >> Gr >> Gc; Sr--; Sc--; Gr--; Gc--;
	vector<string> v(R);
	for(auto &i : v) cin >> i;
	vector<pair<int, int>> added = {{Sr, Sc}};
	vector<vector<int>> dist(R, vector<int>(C, 1e9));
	vector<vector<bool>> vis(R, vector<bool>(C, false));
	vector<vector<pair<int, int>>> best(R, vector<pair<int, int>>(C, {1e9, 1e9}));
	dist[Sr][Sc] = 0;
	for(int t = 0; t < 2*R*C; t++){
		if(t%2==0){
			//Time to freely expand;
			queue<pair<int, int>> q;
			for(pair<int, int>& p : added){
				q.push(p);
			}
			while(!q.empty()){
				int i = q.front().first; int j = q.front().second; q.pop();
				// cout << "i " << i+1 << " j " << j+1 << " dist " << dist[i][j] << "\n";
				for(int ai = -1; ai <= 1; ai++){
					for(int aj = -1; aj <= 1; aj++){
						if(ai * aj != 0 || i + ai < 0 || i + ai >= R || j + aj < 0 || j + aj >= C) continue;
						int ni = i + ai; int nj = j + aj;
						// cout << "ni " << ni << " nj " << nj << "\n";
						if(v[ni][nj] == '.' && dist[ni][nj] > dist[i][j]){
							dist[ni][nj] = dist[i][j];
							added.push_back({ni, nj});
							q.push({ni, nj});
						}
					}
				}
			}
		}else{
			priority_queue<tuple<int, int, int, int>> q;
			int d = 0;
			for(pair<int, int>& p : added){
				q.push({0, 0, p.first, p.second});
				best[p.first][p.second] = {0, 0};
				d = dist[p.first][p.second];
				vis[p.first][p.second] = false;
			}
			added.clear();
			while(!q.empty()){
				int i = get<2>(q.top()); int j = get<3>(q.top()); q.pop();
				if(vis[i][j]) continue;
				vis[i][j] = true;
				// cout << "i " << i+1 << " j " << j << "\n";
				if(best[i][j].first != 0 || best[i][j].second != 0){
					added.push_back({i, j});
				}
				for(int ai = -1; ai <= 1; ai++){
					for(int aj = -1; aj <= 1; aj++){
						if(ai * aj != 0 || i + ai < 0 || i + ai >= R || j + aj < 0 || j + aj >= C) continue;
						int ni = i + ai; int nj = j + aj;
						if(dist[ni][nj] > d && isBest(best[i][j].first+abs(ai), best[i][j].second+abs(aj), best[ni][nj])){
							dist[ni][nj] = d+1;
							best[ni][nj] = {best[i][j].first+abs(ai), best[i][j].second+abs(aj)};
							q.push({-max(best[ni][nj].first, best[ni][nj].second), -min(best[ni][nj].first, best[ni][nj].second), ni, nj});
						}
					}
				}
			}
		}
	}
	cout << dist[Gr][Gc] << "\n";
}
# 결과 실행 시간 메모리 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 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 496 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 18 ms 1292 KB Output is correct
20 Correct 6 ms 1444 KB Output is correct
21 Correct 14 ms 2900 KB Output is correct
22 Correct 22 ms 1432 KB Output is correct
23 Correct 15 ms 1116 KB Output is correct
24 Correct 8 ms 1648 KB Output is correct
25 Correct 8 ms 1648 KB Output is correct
26 Correct 19 ms 1800 KB Output is correct
27 Correct 19 ms 1372 KB Output is correct
28 Correct 18 ms 1116 KB Output is correct
29 Correct 43 ms 2396 KB Output is correct
30 Correct 13 ms 1628 KB Output is correct
31 Correct 36 ms 7764 KB Output is correct
32 Correct 50 ms 2648 KB Output is correct
33 Correct 42 ms 2392 KB Output is correct
34 Correct 22 ms 3484 KB Output is correct
35 Correct 22 ms 3480 KB Output is correct
36 Correct 49 ms 3060 KB Output is correct
37 Correct 49 ms 2748 KB Output is correct
38 Correct 47 ms 2396 KB Output is correct
39 Correct 483 ms 20084 KB Output is correct
40 Correct 48 ms 2652 KB Output is correct
41 Correct 22 ms 4372 KB Output is correct
42 Correct 67 ms 3164 KB Output is correct
43 Correct 44 ms 4476 KB Output is correct
44 Correct 174 ms 11128 KB Output is correct
45 Correct 177 ms 11904 KB Output is correct
46 Correct 459 ms 65380 KB Output is correct
47 Correct 499 ms 20632 KB Output is correct
48 Correct 462 ms 20092 KB Output is correct
49 Correct 167 ms 31512 KB Output is correct
50 Correct 189 ms 31516 KB Output is correct
51 Correct 546 ms 22504 KB Output is correct
52 Correct 513 ms 21056 KB Output is correct
53 Correct 492 ms 20456 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 600 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 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 1 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 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 600 KB Output is correct
27 Correct 0 ms 344 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 420 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 408 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 1 ms 544 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 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 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 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 2 ms 348 KB Output is correct
25 Correct 13 ms 1284 KB Output is correct
26 Correct 15 ms 2652 KB Output is correct
27 Correct 14 ms 2904 KB Output is correct
28 Correct 14 ms 2708 KB Output is correct
29 Correct 22 ms 2800 KB Output is correct
30 Correct 24 ms 2824 KB Output is correct
31 Correct 19 ms 1368 KB Output is correct
32 Correct 21 ms 1800 KB Output is correct
33 Correct 20 ms 1372 KB Output is correct
34 Correct 36 ms 4944 KB Output is correct
35 Correct 36 ms 8276 KB Output is correct
36 Correct 37 ms 9296 KB Output is correct
37 Correct 54 ms 7776 KB Output is correct
38 Correct 51 ms 8540 KB Output is correct
39 Correct 149 ms 20300 KB Output is correct
40 Correct 494 ms 41072 KB Output is correct
41 Correct 465 ms 66180 KB Output is correct
42 Correct 478 ms 65832 KB Output is correct
43 Correct 706 ms 67048 KB Output is correct
44 Correct 678 ms 65504 KB Output is correct
45 Correct 855 ms 55376 KB Output is correct
46 Correct 979 ms 54400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 600 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 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 1 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 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 600 KB Output is correct
27 Correct 0 ms 344 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 420 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 24 ms 1276 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 544 KB Output is correct
36 Correct 14 ms 1008 KB Output is correct
37 Correct 6 ms 1444 KB Output is correct
38 Correct 15 ms 2652 KB Output is correct
39 Correct 14 ms 2904 KB Output is correct
40 Correct 22 ms 1116 KB Output is correct
41 Correct 16 ms 1296 KB Output is correct
42 Correct 16 ms 2904 KB Output is correct
43 Correct 23 ms 2832 KB Output is correct
44 Correct 21 ms 2820 KB Output is correct
45 Correct 8 ms 1644 KB Output is correct
46 Correct 11 ms 1648 KB Output is correct
47 Correct 16 ms 1628 KB Output is correct
48 Correct 25 ms 1288 KB Output is correct
49 Correct 27 ms 1324 KB Output is correct
50 Correct 22 ms 1112 KB Output is correct
51 Correct 22 ms 1544 KB Output is correct
52 Correct 20 ms 1804 KB Output is correct
53 Correct 23 ms 1372 KB Output is correct
54 Correct 18 ms 1112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 600 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 600 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 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 1 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 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 600 KB Output is correct
27 Correct 0 ms 344 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 420 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 24 ms 1276 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 544 KB Output is correct
36 Correct 14 ms 1008 KB Output is correct
37 Correct 6 ms 1444 KB Output is correct
38 Correct 15 ms 2652 KB Output is correct
39 Correct 14 ms 2904 KB Output is correct
40 Correct 22 ms 1116 KB Output is correct
41 Correct 16 ms 1296 KB Output is correct
42 Correct 16 ms 2904 KB Output is correct
43 Correct 23 ms 2832 KB Output is correct
44 Correct 21 ms 2820 KB Output is correct
45 Correct 8 ms 1644 KB Output is correct
46 Correct 11 ms 1648 KB Output is correct
47 Correct 16 ms 1628 KB Output is correct
48 Correct 25 ms 1288 KB Output is correct
49 Correct 27 ms 1324 KB Output is correct
50 Correct 22 ms 1112 KB Output is correct
51 Correct 22 ms 1544 KB Output is correct
52 Correct 20 ms 1804 KB Output is correct
53 Correct 23 ms 1372 KB Output is correct
54 Correct 18 ms 1112 KB Output is correct
55 Correct 46 ms 2396 KB Output is correct
56 Correct 13 ms 1628 KB Output is correct
57 Correct 43 ms 4948 KB Output is correct
58 Correct 45 ms 2140 KB Output is correct
59 Correct 36 ms 9808 KB Output is correct
60 Correct 47 ms 2396 KB Output is correct
61 Correct 40 ms 2392 KB Output is correct
62 Correct 39 ms 8788 KB Output is correct
63 Correct 58 ms 9620 KB Output is correct
64 Correct 52 ms 8084 KB Output is correct
65 Correct 21 ms 3484 KB Output is correct
66 Correct 20 ms 3484 KB Output is correct
67 Correct 28 ms 2868 KB Output is correct
68 Correct 48 ms 2392 KB Output is correct
69 Correct 47 ms 2576 KB Output is correct
70 Correct 46 ms 2732 KB Output is correct
71 Correct 50 ms 3124 KB Output is correct
72 Correct 54 ms 3160 KB Output is correct
73 Correct 49 ms 2748 KB Output is correct
74 Correct 46 ms 2396 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 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 496 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 18 ms 1292 KB Output is correct
20 Correct 6 ms 1444 KB Output is correct
21 Correct 14 ms 2900 KB Output is correct
22 Correct 22 ms 1432 KB Output is correct
23 Correct 15 ms 1116 KB Output is correct
24 Correct 8 ms 1648 KB Output is correct
25 Correct 8 ms 1648 KB Output is correct
26 Correct 19 ms 1800 KB Output is correct
27 Correct 19 ms 1372 KB Output is correct
28 Correct 18 ms 1116 KB Output is correct
29 Correct 43 ms 2396 KB Output is correct
30 Correct 13 ms 1628 KB Output is correct
31 Correct 36 ms 7764 KB Output is correct
32 Correct 50 ms 2648 KB Output is correct
33 Correct 42 ms 2392 KB Output is correct
34 Correct 22 ms 3484 KB Output is correct
35 Correct 22 ms 3480 KB Output is correct
36 Correct 49 ms 3060 KB Output is correct
37 Correct 49 ms 2748 KB Output is correct
38 Correct 47 ms 2396 KB Output is correct
39 Correct 483 ms 20084 KB Output is correct
40 Correct 48 ms 2652 KB Output is correct
41 Correct 22 ms 4372 KB Output is correct
42 Correct 67 ms 3164 KB Output is correct
43 Correct 44 ms 4476 KB Output is correct
44 Correct 174 ms 11128 KB Output is correct
45 Correct 177 ms 11904 KB Output is correct
46 Correct 459 ms 65380 KB Output is correct
47 Correct 499 ms 20632 KB Output is correct
48 Correct 462 ms 20092 KB Output is correct
49 Correct 167 ms 31512 KB Output is correct
50 Correct 189 ms 31516 KB Output is correct
51 Correct 546 ms 22504 KB Output is correct
52 Correct 513 ms 21056 KB Output is correct
53 Correct 492 ms 20456 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 600 KB Output is correct
56 Correct 0 ms 600 KB Output is correct
57 Correct 0 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 0 ms 348 KB Output is correct
61 Correct 0 ms 600 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 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 1 ms 600 KB Output is correct
80 Correct 0 ms 344 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 420 KB Output is correct
84 Correct 1 ms 344 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 408 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 1 ms 544 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 1 ms 348 KB Output is correct
95 Correct 1 ms 344 KB Output is correct
96 Correct 1 ms 348 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 0 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 1 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 1 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 2 ms 348 KB Output is correct
110 Correct 13 ms 1284 KB Output is correct
111 Correct 15 ms 2652 KB Output is correct
112 Correct 14 ms 2904 KB Output is correct
113 Correct 14 ms 2708 KB Output is correct
114 Correct 22 ms 2800 KB Output is correct
115 Correct 24 ms 2824 KB Output is correct
116 Correct 19 ms 1368 KB Output is correct
117 Correct 21 ms 1800 KB Output is correct
118 Correct 20 ms 1372 KB Output is correct
119 Correct 36 ms 4944 KB Output is correct
120 Correct 36 ms 8276 KB Output is correct
121 Correct 37 ms 9296 KB Output is correct
122 Correct 54 ms 7776 KB Output is correct
123 Correct 51 ms 8540 KB Output is correct
124 Correct 149 ms 20300 KB Output is correct
125 Correct 494 ms 41072 KB Output is correct
126 Correct 465 ms 66180 KB Output is correct
127 Correct 478 ms 65832 KB Output is correct
128 Correct 706 ms 67048 KB Output is correct
129 Correct 678 ms 65504 KB Output is correct
130 Correct 855 ms 55376 KB Output is correct
131 Correct 979 ms 54400 KB Output is correct
132 Correct 24 ms 1276 KB Output is correct
133 Correct 1 ms 348 KB Output is correct
134 Correct 1 ms 544 KB Output is correct
135 Correct 14 ms 1008 KB Output is correct
136 Correct 6 ms 1444 KB Output is correct
137 Correct 15 ms 2652 KB Output is correct
138 Correct 14 ms 2904 KB Output is correct
139 Correct 22 ms 1116 KB Output is correct
140 Correct 16 ms 1296 KB Output is correct
141 Correct 16 ms 2904 KB Output is correct
142 Correct 23 ms 2832 KB Output is correct
143 Correct 21 ms 2820 KB Output is correct
144 Correct 8 ms 1644 KB Output is correct
145 Correct 11 ms 1648 KB Output is correct
146 Correct 16 ms 1628 KB Output is correct
147 Correct 25 ms 1288 KB Output is correct
148 Correct 27 ms 1324 KB Output is correct
149 Correct 22 ms 1112 KB Output is correct
150 Correct 22 ms 1544 KB Output is correct
151 Correct 20 ms 1804 KB Output is correct
152 Correct 23 ms 1372 KB Output is correct
153 Correct 18 ms 1112 KB Output is correct
154 Correct 46 ms 2396 KB Output is correct
155 Correct 13 ms 1628 KB Output is correct
156 Correct 43 ms 4948 KB Output is correct
157 Correct 45 ms 2140 KB Output is correct
158 Correct 36 ms 9808 KB Output is correct
159 Correct 47 ms 2396 KB Output is correct
160 Correct 40 ms 2392 KB Output is correct
161 Correct 39 ms 8788 KB Output is correct
162 Correct 58 ms 9620 KB Output is correct
163 Correct 52 ms 8084 KB Output is correct
164 Correct 21 ms 3484 KB Output is correct
165 Correct 20 ms 3484 KB Output is correct
166 Correct 28 ms 2868 KB Output is correct
167 Correct 48 ms 2392 KB Output is correct
168 Correct 47 ms 2576 KB Output is correct
169 Correct 46 ms 2732 KB Output is correct
170 Correct 50 ms 3124 KB Output is correct
171 Correct 54 ms 3160 KB Output is correct
172 Correct 49 ms 2748 KB Output is correct
173 Correct 46 ms 2396 KB Output is correct
174 Correct 59 ms 3160 KB Output is correct
175 Correct 104 ms 4976 KB Output is correct
176 Correct 175 ms 12312 KB Output is correct
177 Correct 350 ms 13732 KB Output is correct
178 Correct 462 ms 17868 KB Output is correct
179 Correct 455 ms 20432 KB Output is correct
180 Correct 503 ms 20664 KB Output is correct
181 Correct 537 ms 21380 KB Output is correct
182 Correct 567 ms 24036 KB Output is correct
183 Correct 491 ms 29364 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 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 496 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 18 ms 1292 KB Output is correct
20 Correct 6 ms 1444 KB Output is correct
21 Correct 14 ms 2900 KB Output is correct
22 Correct 22 ms 1432 KB Output is correct
23 Correct 15 ms 1116 KB Output is correct
24 Correct 8 ms 1648 KB Output is correct
25 Correct 8 ms 1648 KB Output is correct
26 Correct 19 ms 1800 KB Output is correct
27 Correct 19 ms 1372 KB Output is correct
28 Correct 18 ms 1116 KB Output is correct
29 Correct 43 ms 2396 KB Output is correct
30 Correct 13 ms 1628 KB Output is correct
31 Correct 36 ms 7764 KB Output is correct
32 Correct 50 ms 2648 KB Output is correct
33 Correct 42 ms 2392 KB Output is correct
34 Correct 22 ms 3484 KB Output is correct
35 Correct 22 ms 3480 KB Output is correct
36 Correct 49 ms 3060 KB Output is correct
37 Correct 49 ms 2748 KB Output is correct
38 Correct 47 ms 2396 KB Output is correct
39 Correct 483 ms 20084 KB Output is correct
40 Correct 48 ms 2652 KB Output is correct
41 Correct 22 ms 4372 KB Output is correct
42 Correct 67 ms 3164 KB Output is correct
43 Correct 44 ms 4476 KB Output is correct
44 Correct 174 ms 11128 KB Output is correct
45 Correct 177 ms 11904 KB Output is correct
46 Correct 459 ms 65380 KB Output is correct
47 Correct 499 ms 20632 KB Output is correct
48 Correct 462 ms 20092 KB Output is correct
49 Correct 167 ms 31512 KB Output is correct
50 Correct 189 ms 31516 KB Output is correct
51 Correct 546 ms 22504 KB Output is correct
52 Correct 513 ms 21056 KB Output is correct
53 Correct 492 ms 20456 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 600 KB Output is correct
56 Correct 0 ms 600 KB Output is correct
57 Correct 0 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 0 ms 348 KB Output is correct
61 Correct 0 ms 600 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 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 1 ms 600 KB Output is correct
80 Correct 0 ms 344 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 420 KB Output is correct
84 Correct 1 ms 344 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 408 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 1 ms 544 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 1 ms 348 KB Output is correct
95 Correct 1 ms 344 KB Output is correct
96 Correct 1 ms 348 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 0 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 1 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 1 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 2 ms 348 KB Output is correct
110 Correct 13 ms 1284 KB Output is correct
111 Correct 15 ms 2652 KB Output is correct
112 Correct 14 ms 2904 KB Output is correct
113 Correct 14 ms 2708 KB Output is correct
114 Correct 22 ms 2800 KB Output is correct
115 Correct 24 ms 2824 KB Output is correct
116 Correct 19 ms 1368 KB Output is correct
117 Correct 21 ms 1800 KB Output is correct
118 Correct 20 ms 1372 KB Output is correct
119 Correct 36 ms 4944 KB Output is correct
120 Correct 36 ms 8276 KB Output is correct
121 Correct 37 ms 9296 KB Output is correct
122 Correct 54 ms 7776 KB Output is correct
123 Correct 51 ms 8540 KB Output is correct
124 Correct 149 ms 20300 KB Output is correct
125 Correct 494 ms 41072 KB Output is correct
126 Correct 465 ms 66180 KB Output is correct
127 Correct 478 ms 65832 KB Output is correct
128 Correct 706 ms 67048 KB Output is correct
129 Correct 678 ms 65504 KB Output is correct
130 Correct 855 ms 55376 KB Output is correct
131 Correct 979 ms 54400 KB Output is correct
132 Correct 24 ms 1276 KB Output is correct
133 Correct 1 ms 348 KB Output is correct
134 Correct 1 ms 544 KB Output is correct
135 Correct 14 ms 1008 KB Output is correct
136 Correct 6 ms 1444 KB Output is correct
137 Correct 15 ms 2652 KB Output is correct
138 Correct 14 ms 2904 KB Output is correct
139 Correct 22 ms 1116 KB Output is correct
140 Correct 16 ms 1296 KB Output is correct
141 Correct 16 ms 2904 KB Output is correct
142 Correct 23 ms 2832 KB Output is correct
143 Correct 21 ms 2820 KB Output is correct
144 Correct 8 ms 1644 KB Output is correct
145 Correct 11 ms 1648 KB Output is correct
146 Correct 16 ms 1628 KB Output is correct
147 Correct 25 ms 1288 KB Output is correct
148 Correct 27 ms 1324 KB Output is correct
149 Correct 22 ms 1112 KB Output is correct
150 Correct 22 ms 1544 KB Output is correct
151 Correct 20 ms 1804 KB Output is correct
152 Correct 23 ms 1372 KB Output is correct
153 Correct 18 ms 1112 KB Output is correct
154 Correct 46 ms 2396 KB Output is correct
155 Correct 13 ms 1628 KB Output is correct
156 Correct 43 ms 4948 KB Output is correct
157 Correct 45 ms 2140 KB Output is correct
158 Correct 36 ms 9808 KB Output is correct
159 Correct 47 ms 2396 KB Output is correct
160 Correct 40 ms 2392 KB Output is correct
161 Correct 39 ms 8788 KB Output is correct
162 Correct 58 ms 9620 KB Output is correct
163 Correct 52 ms 8084 KB Output is correct
164 Correct 21 ms 3484 KB Output is correct
165 Correct 20 ms 3484 KB Output is correct
166 Correct 28 ms 2868 KB Output is correct
167 Correct 48 ms 2392 KB Output is correct
168 Correct 47 ms 2576 KB Output is correct
169 Correct 46 ms 2732 KB Output is correct
170 Correct 50 ms 3124 KB Output is correct
171 Correct 54 ms 3160 KB Output is correct
172 Correct 49 ms 2748 KB Output is correct
173 Correct 46 ms 2396 KB Output is correct
174 Correct 59 ms 3160 KB Output is correct
175 Correct 104 ms 4976 KB Output is correct
176 Correct 175 ms 12312 KB Output is correct
177 Correct 350 ms 13732 KB Output is correct
178 Correct 462 ms 17868 KB Output is correct
179 Correct 455 ms 20432 KB Output is correct
180 Correct 503 ms 20664 KB Output is correct
181 Correct 537 ms 21380 KB Output is correct
182 Correct 567 ms 24036 KB Output is correct
183 Correct 491 ms 29364 KB Output is correct
184 Correct 1113 ms 39644 KB Output is correct
185 Correct 543 ms 22168 KB Output is correct
186 Correct 619 ms 66480 KB Output is correct
187 Correct 752 ms 32816 KB Output is correct
188 Correct 1032 ms 129808 KB Output is correct
189 Correct 1034 ms 40380 KB Output is correct
190 Correct 982 ms 39624 KB Output is correct
191 Correct 1036 ms 129968 KB Output is correct
192 Correct 1503 ms 129844 KB Output is correct
193 Correct 1342 ms 130984 KB Output is correct
194 Correct 358 ms 63552 KB Output is correct
195 Correct 404 ms 63044 KB Output is correct
196 Correct 953 ms 39920 KB Output is correct
197 Correct 981 ms 40916 KB Output is correct
198 Correct 1022 ms 41632 KB Output is correct
199 Correct 1074 ms 44624 KB Output is correct
200 Correct 1203 ms 43552 KB Output is correct
201 Correct 1070 ms 41536 KB Output is correct
202 Correct 1024 ms 40024 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 1 ms 348 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 496 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 18 ms 1292 KB Output is correct
20 Correct 6 ms 1444 KB Output is correct
21 Correct 14 ms 2900 KB Output is correct
22 Correct 22 ms 1432 KB Output is correct
23 Correct 15 ms 1116 KB Output is correct
24 Correct 8 ms 1648 KB Output is correct
25 Correct 8 ms 1648 KB Output is correct
26 Correct 19 ms 1800 KB Output is correct
27 Correct 19 ms 1372 KB Output is correct
28 Correct 18 ms 1116 KB Output is correct
29 Correct 43 ms 2396 KB Output is correct
30 Correct 13 ms 1628 KB Output is correct
31 Correct 36 ms 7764 KB Output is correct
32 Correct 50 ms 2648 KB Output is correct
33 Correct 42 ms 2392 KB Output is correct
34 Correct 22 ms 3484 KB Output is correct
35 Correct 22 ms 3480 KB Output is correct
36 Correct 49 ms 3060 KB Output is correct
37 Correct 49 ms 2748 KB Output is correct
38 Correct 47 ms 2396 KB Output is correct
39 Correct 483 ms 20084 KB Output is correct
40 Correct 48 ms 2652 KB Output is correct
41 Correct 22 ms 4372 KB Output is correct
42 Correct 67 ms 3164 KB Output is correct
43 Correct 44 ms 4476 KB Output is correct
44 Correct 174 ms 11128 KB Output is correct
45 Correct 177 ms 11904 KB Output is correct
46 Correct 459 ms 65380 KB Output is correct
47 Correct 499 ms 20632 KB Output is correct
48 Correct 462 ms 20092 KB Output is correct
49 Correct 167 ms 31512 KB Output is correct
50 Correct 189 ms 31516 KB Output is correct
51 Correct 546 ms 22504 KB Output is correct
52 Correct 513 ms 21056 KB Output is correct
53 Correct 492 ms 20456 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 0 ms 600 KB Output is correct
56 Correct 0 ms 600 KB Output is correct
57 Correct 0 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 0 ms 348 KB Output is correct
61 Correct 0 ms 600 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 348 KB Output is correct
65 Correct 0 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 1 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 0 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 0 ms 348 KB Output is correct
79 Correct 1 ms 600 KB Output is correct
80 Correct 0 ms 344 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 420 KB Output is correct
84 Correct 1 ms 344 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 408 KB Output is correct
88 Correct 0 ms 348 KB Output is correct
89 Correct 0 ms 348 KB Output is correct
90 Correct 0 ms 348 KB Output is correct
91 Correct 0 ms 348 KB Output is correct
92 Correct 1 ms 544 KB Output is correct
93 Correct 1 ms 348 KB Output is correct
94 Correct 1 ms 348 KB Output is correct
95 Correct 1 ms 344 KB Output is correct
96 Correct 1 ms 348 KB Output is correct
97 Correct 0 ms 348 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 0 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 0 ms 348 KB Output is correct
102 Correct 0 ms 348 KB Output is correct
103 Correct 0 ms 348 KB Output is correct
104 Correct 1 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 1 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 2 ms 348 KB Output is correct
110 Correct 13 ms 1284 KB Output is correct
111 Correct 15 ms 2652 KB Output is correct
112 Correct 14 ms 2904 KB Output is correct
113 Correct 14 ms 2708 KB Output is correct
114 Correct 22 ms 2800 KB Output is correct
115 Correct 24 ms 2824 KB Output is correct
116 Correct 19 ms 1368 KB Output is correct
117 Correct 21 ms 1800 KB Output is correct
118 Correct 20 ms 1372 KB Output is correct
119 Correct 36 ms 4944 KB Output is correct
120 Correct 36 ms 8276 KB Output is correct
121 Correct 37 ms 9296 KB Output is correct
122 Correct 54 ms 7776 KB Output is correct
123 Correct 51 ms 8540 KB Output is correct
124 Correct 149 ms 20300 KB Output is correct
125 Correct 494 ms 41072 KB Output is correct
126 Correct 465 ms 66180 KB Output is correct
127 Correct 478 ms 65832 KB Output is correct
128 Correct 706 ms 67048 KB Output is correct
129 Correct 678 ms 65504 KB Output is correct
130 Correct 855 ms 55376 KB Output is correct
131 Correct 979 ms 54400 KB Output is correct
132 Correct 24 ms 1276 KB Output is correct
133 Correct 1 ms 348 KB Output is correct
134 Correct 1 ms 544 KB Output is correct
135 Correct 14 ms 1008 KB Output is correct
136 Correct 6 ms 1444 KB Output is correct
137 Correct 15 ms 2652 KB Output is correct
138 Correct 14 ms 2904 KB Output is correct
139 Correct 22 ms 1116 KB Output is correct
140 Correct 16 ms 1296 KB Output is correct
141 Correct 16 ms 2904 KB Output is correct
142 Correct 23 ms 2832 KB Output is correct
143 Correct 21 ms 2820 KB Output is correct
144 Correct 8 ms 1644 KB Output is correct
145 Correct 11 ms 1648 KB Output is correct
146 Correct 16 ms 1628 KB Output is correct
147 Correct 25 ms 1288 KB Output is correct
148 Correct 27 ms 1324 KB Output is correct
149 Correct 22 ms 1112 KB Output is correct
150 Correct 22 ms 1544 KB Output is correct
151 Correct 20 ms 1804 KB Output is correct
152 Correct 23 ms 1372 KB Output is correct
153 Correct 18 ms 1112 KB Output is correct
154 Correct 46 ms 2396 KB Output is correct
155 Correct 13 ms 1628 KB Output is correct
156 Correct 43 ms 4948 KB Output is correct
157 Correct 45 ms 2140 KB Output is correct
158 Correct 36 ms 9808 KB Output is correct
159 Correct 47 ms 2396 KB Output is correct
160 Correct 40 ms 2392 KB Output is correct
161 Correct 39 ms 8788 KB Output is correct
162 Correct 58 ms 9620 KB Output is correct
163 Correct 52 ms 8084 KB Output is correct
164 Correct 21 ms 3484 KB Output is correct
165 Correct 20 ms 3484 KB Output is correct
166 Correct 28 ms 2868 KB Output is correct
167 Correct 48 ms 2392 KB Output is correct
168 Correct 47 ms 2576 KB Output is correct
169 Correct 46 ms 2732 KB Output is correct
170 Correct 50 ms 3124 KB Output is correct
171 Correct 54 ms 3160 KB Output is correct
172 Correct 49 ms 2748 KB Output is correct
173 Correct 46 ms 2396 KB Output is correct
174 Correct 59 ms 3160 KB Output is correct
175 Correct 104 ms 4976 KB Output is correct
176 Correct 175 ms 12312 KB Output is correct
177 Correct 350 ms 13732 KB Output is correct
178 Correct 462 ms 17868 KB Output is correct
179 Correct 455 ms 20432 KB Output is correct
180 Correct 503 ms 20664 KB Output is correct
181 Correct 537 ms 21380 KB Output is correct
182 Correct 567 ms 24036 KB Output is correct
183 Correct 491 ms 29364 KB Output is correct
184 Correct 1113 ms 39644 KB Output is correct
185 Correct 543 ms 22168 KB Output is correct
186 Correct 619 ms 66480 KB Output is correct
187 Correct 752 ms 32816 KB Output is correct
188 Correct 1032 ms 129808 KB Output is correct
189 Correct 1034 ms 40380 KB Output is correct
190 Correct 982 ms 39624 KB Output is correct
191 Correct 1036 ms 129968 KB Output is correct
192 Correct 1503 ms 129844 KB Output is correct
193 Correct 1342 ms 130984 KB Output is correct
194 Correct 358 ms 63552 KB Output is correct
195 Correct 404 ms 63044 KB Output is correct
196 Correct 953 ms 39920 KB Output is correct
197 Correct 981 ms 40916 KB Output is correct
198 Correct 1022 ms 41632 KB Output is correct
199 Correct 1074 ms 44624 KB Output is correct
200 Correct 1203 ms 43552 KB Output is correct
201 Correct 1070 ms 41536 KB Output is correct
202 Correct 1024 ms 40024 KB Output is correct
203 Execution timed out 2057 ms 78872 KB Time limit exceeded
204 Halted 0 ms 0 KB -