답안 #860524

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
860524 2023-10-13T07:39:34 Z NotLinux Maze (JOI23_ho_t3) C++17
86 / 100
2000 ms 308720 KB
#include <bits/stdc++.h>
using namespace std;
void solve(){
	int r,c,n;
	cin >> r >> c >> n;	
	pair < int , int > s,g;
	cin >> s.first >> s.second >> g.first >> g.second;
	s.first--;s.second--;g.first--;g.second--;
	int grid[r][c];
	set < int > hor[r] , ver[c];
	for(int i = 0;i<r;i++){//1 = # , 0 = .
		string str;cin >> str;
		for(int j = 0;j<c;j++){
			grid[i][j] = str[j] == '#';
			if(i != s.first or j != s.second){
				ver[j].insert(i);
				hor[i].insert(j);
			}
		}
	}
	priority_queue < pair < int , pair < int , int > > > bfs;//{dist,{x,y}}
	bfs.push({0,s});
	int vis[r][c];
	memset(vis , 0 , sizeof(vis));
	while(bfs.size()){
		pair < int , int > p = bfs.top().second;
		int dist = -bfs.top().first;
		bfs.pop();
		if(vis[p.first][p.second])continue;
		//cout << "bfs : " << p.first << " " << p.second << " " << dist << endl;
		vis[p.first][p.second] = 1;
		if(p == g){
			cout << dist << '\n';
			return;
		}
		//spread
		if((p.first+n) < r){//	({n,-n} , {n,n})
			auto lb = hor[p.first + n].upper_bound(p.second - n);
			auto ub = hor[p.first + n].lower_bound(p.second + n);
			if(lb != hor[p.first + n].end() and ub != hor[p.first + n].begin()){
				vector < int > willdel;
				for(auto it = lb;it != ub;++it){
					willdel.push_back(*it);
				}
				for(auto itr : willdel){
					bfs.push({-dist-1,{p.first + n , itr}});
					hor[p.first + n].extract(itr);
					ver[itr].extract(p.first + n);
				}
			}
		}
		if((p.first - n) >= 0){//	({-n,-n} , {-n,n})
			auto lb = hor[p.first - n].upper_bound(p.second - n);
			auto ub = hor[p.first - n].lower_bound(p.second + n);
			if(lb != hor[p.first - n].end() and ub != hor[p.first - n].begin()){
				vector < int > willdel;
				for(auto it = lb;it != ub;++it){
					willdel.push_back(*it);
				}
				for(auto itr : willdel){
					bfs.push({-dist-1,{p.first - n , itr}});
					hor[p.first - n].extract(itr);
					ver[itr].extract(p.first - n);
				}
			}
		}
		if((p.second + n) < c){//	({-n,n} , {n,n})
			auto lb = ver[p.second + n].upper_bound(p.first - n);
			auto ub = ver[p.second + n].lower_bound(p.first + n);
			if(lb != ver[p.second + n].end() and ub != ver[p.second + n].begin()){
				vector < int > willdel;
				for(auto it = lb;it != ub;++it){
					willdel.push_back(*it);
				}
				for(auto itr : willdel){
					bfs.push({-dist-1,{itr , p.second + n,}});
					ver[p.second + n].extract(itr);
					hor[itr].extract(p.second + n);
				}
			}
		}
		if((p.second - n) >= 0){//	({-n,-n} , {n,-n})
			auto lb = ver[p.second - n].upper_bound(p.first - n);
			auto ub = ver[p.second - n].lower_bound(p.first + n);
			if(lb != ver[p.second - n].end() and ub != ver[p.second - n].begin()){
				vector < int > willdel;
				for(auto it = lb;it != ub;++it){
					willdel.push_back(*it);
				}
				for(auto itr : willdel){
					bfs.push({-dist-1,{itr , p.second - n,}});
					ver[p.second - n].extract(itr);
					hor[itr].extract(p.second - n);
				}
			}
		}
		if(p.first != 0 and grid[p.first-1][p.second] == 0)bfs.push({-dist,{p.first-1,p.second}});
		if(p.second != 0 and grid[p.first][p.second-1] == 0)bfs.push({-dist,{p.first,p.second-1}});
		if(p.first != (r-1) and grid[p.first+1][p.second] == 0)bfs.push({-dist,{p.first+1,p.second}});
		if(p.second != (c-1) and grid[p.first][p.second+1] == 0)bfs.push({-dist,{p.first,p.second+1}});
		if((abs(g.first - p.first) <= n and abs(g.second - p.second) <= (n-1)) or (abs(g.first - p.first) <= (n-1) and abs(g.second - p.second) <= n)){
			bfs.push({-dist-1,g});
		}
	}
	cout << -1 << '\n';
}
signed main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	int testcase = 1;//cin >> testcase;
	while(testcase--)solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
7 Correct 1 ms 600 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 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 356 KB Output is correct
15 Correct 0 ms 348 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 348 KB Output is correct
19 Correct 29 ms 6456 KB Output is correct
20 Correct 14 ms 7256 KB Output is correct
21 Correct 34 ms 6488 KB Output is correct
22 Correct 43 ms 6644 KB Output is correct
23 Correct 27 ms 6740 KB Output is correct
24 Correct 28 ms 9308 KB Output is correct
25 Correct 19 ms 9308 KB Output is correct
26 Correct 14 ms 6492 KB Output is correct
27 Correct 14 ms 6704 KB Output is correct
28 Correct 21 ms 6768 KB Output is correct
29 Correct 92 ms 15952 KB Output is correct
30 Correct 25 ms 8024 KB Output is correct
31 Correct 72 ms 15948 KB Output is correct
32 Correct 125 ms 15708 KB Output is correct
33 Correct 81 ms 15704 KB Output is correct
34 Correct 92 ms 22884 KB Output is correct
35 Correct 54 ms 22856 KB Output is correct
36 Correct 98 ms 16148 KB Output is correct
37 Correct 114 ms 15876 KB Output is correct
38 Correct 41 ms 15804 KB Output is correct
39 Correct 1121 ms 154840 KB Output is correct
40 Correct 58 ms 18408 KB Output is correct
41 Correct 70 ms 27940 KB Output is correct
42 Correct 138 ms 22512 KB Output is correct
43 Correct 106 ms 30940 KB Output is correct
44 Correct 379 ms 82636 KB Output is correct
45 Correct 349 ms 90676 KB Output is correct
46 Correct 1147 ms 154808 KB Output is correct
47 Correct 1303 ms 155064 KB Output is correct
48 Correct 971 ms 154752 KB Output is correct
49 Correct 929 ms 225000 KB Output is correct
50 Correct 720 ms 224992 KB Output is correct
51 Correct 1367 ms 155552 KB Output is correct
52 Correct 1061 ms 154792 KB Output is correct
53 Correct 1016 ms 154956 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 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 1 ms 600 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 0 ms 460 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 452 KB Output is correct
19 Correct 1 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 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 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 348 KB Output is correct
3 Correct 0 ms 448 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 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 0 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 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 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 604 KB Output is correct
25 Correct 10 ms 4300 KB Output is correct
26 Correct 14 ms 6488 KB Output is correct
27 Correct 33 ms 6620 KB Output is correct
28 Correct 16 ms 6744 KB Output is correct
29 Correct 11 ms 6492 KB Output is correct
30 Correct 13 ms 6492 KB Output is correct
31 Correct 21 ms 6940 KB Output is correct
32 Correct 14 ms 6488 KB Output is correct
33 Correct 14 ms 6620 KB Output is correct
34 Correct 38 ms 13920 KB Output is correct
35 Correct 73 ms 16124 KB Output is correct
36 Correct 47 ms 16160 KB Output is correct
37 Correct 36 ms 15700 KB Output is correct
38 Correct 35 ms 15708 KB Output is correct
39 Correct 147 ms 46128 KB Output is correct
40 Correct 833 ms 156612 KB Output is correct
41 Correct 1168 ms 155056 KB Output is correct
42 Correct 1069 ms 181436 KB Output is correct
43 Correct 497 ms 154404 KB Output is correct
44 Correct 493 ms 154436 KB Output is correct
45 Correct 1102 ms 182208 KB Output is correct
46 Correct 880 ms 180280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 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 1 ms 600 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 0 ms 460 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 452 KB Output is correct
19 Correct 1 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 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 34 ms 6596 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 860 KB Output is correct
36 Correct 10 ms 4184 KB Output is correct
37 Correct 14 ms 7260 KB Output is correct
38 Correct 14 ms 6316 KB Output is correct
39 Correct 35 ms 6492 KB Output is correct
40 Correct 44 ms 6636 KB Output is correct
41 Correct 28 ms 6488 KB Output is correct
42 Correct 19 ms 6948 KB Output is correct
43 Correct 11 ms 6492 KB Output is correct
44 Correct 11 ms 6492 KB Output is correct
45 Correct 29 ms 9340 KB Output is correct
46 Correct 20 ms 9308 KB Output is correct
47 Correct 23 ms 7880 KB Output is correct
48 Correct 29 ms 6744 KB Output is correct
49 Correct 26 ms 6748 KB Output is correct
50 Correct 42 ms 6748 KB Output is correct
51 Correct 23 ms 6928 KB Output is correct
52 Correct 14 ms 6492 KB Output is correct
53 Correct 16 ms 6492 KB Output is correct
54 Correct 21 ms 6492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 344 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 1 ms 600 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 0 ms 460 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 452 KB Output is correct
19 Correct 1 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 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 34 ms 6596 KB Output is correct
34 Correct 1 ms 604 KB Output is correct
35 Correct 1 ms 860 KB Output is correct
36 Correct 10 ms 4184 KB Output is correct
37 Correct 14 ms 7260 KB Output is correct
38 Correct 14 ms 6316 KB Output is correct
39 Correct 35 ms 6492 KB Output is correct
40 Correct 44 ms 6636 KB Output is correct
41 Correct 28 ms 6488 KB Output is correct
42 Correct 19 ms 6948 KB Output is correct
43 Correct 11 ms 6492 KB Output is correct
44 Correct 11 ms 6492 KB Output is correct
45 Correct 29 ms 9340 KB Output is correct
46 Correct 20 ms 9308 KB Output is correct
47 Correct 23 ms 7880 KB Output is correct
48 Correct 29 ms 6744 KB Output is correct
49 Correct 26 ms 6748 KB Output is correct
50 Correct 42 ms 6748 KB Output is correct
51 Correct 23 ms 6928 KB Output is correct
52 Correct 14 ms 6492 KB Output is correct
53 Correct 16 ms 6492 KB Output is correct
54 Correct 21 ms 6492 KB Output is correct
55 Correct 85 ms 15856 KB Output is correct
56 Correct 28 ms 8208 KB Output is correct
57 Correct 43 ms 13808 KB Output is correct
58 Correct 77 ms 14980 KB Output is correct
59 Correct 66 ms 15764 KB Output is correct
60 Correct 126 ms 15944 KB Output is correct
61 Correct 80 ms 15864 KB Output is correct
62 Correct 40 ms 16132 KB Output is correct
63 Correct 36 ms 15700 KB Output is correct
64 Correct 36 ms 15612 KB Output is correct
65 Correct 89 ms 22868 KB Output is correct
66 Correct 52 ms 22860 KB Output is correct
67 Correct 74 ms 19284 KB Output is correct
68 Correct 96 ms 16276 KB Output is correct
69 Correct 101 ms 16208 KB Output is correct
70 Correct 96 ms 16216 KB Output is correct
71 Correct 98 ms 16664 KB Output is correct
72 Correct 101 ms 16140 KB Output is correct
73 Correct 118 ms 15952 KB Output is correct
74 Correct 47 ms 15704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
7 Correct 1 ms 600 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 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 356 KB Output is correct
15 Correct 0 ms 348 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 348 KB Output is correct
19 Correct 29 ms 6456 KB Output is correct
20 Correct 14 ms 7256 KB Output is correct
21 Correct 34 ms 6488 KB Output is correct
22 Correct 43 ms 6644 KB Output is correct
23 Correct 27 ms 6740 KB Output is correct
24 Correct 28 ms 9308 KB Output is correct
25 Correct 19 ms 9308 KB Output is correct
26 Correct 14 ms 6492 KB Output is correct
27 Correct 14 ms 6704 KB Output is correct
28 Correct 21 ms 6768 KB Output is correct
29 Correct 92 ms 15952 KB Output is correct
30 Correct 25 ms 8024 KB Output is correct
31 Correct 72 ms 15948 KB Output is correct
32 Correct 125 ms 15708 KB Output is correct
33 Correct 81 ms 15704 KB Output is correct
34 Correct 92 ms 22884 KB Output is correct
35 Correct 54 ms 22856 KB Output is correct
36 Correct 98 ms 16148 KB Output is correct
37 Correct 114 ms 15876 KB Output is correct
38 Correct 41 ms 15804 KB Output is correct
39 Correct 1121 ms 154840 KB Output is correct
40 Correct 58 ms 18408 KB Output is correct
41 Correct 70 ms 27940 KB Output is correct
42 Correct 138 ms 22512 KB Output is correct
43 Correct 106 ms 30940 KB Output is correct
44 Correct 379 ms 82636 KB Output is correct
45 Correct 349 ms 90676 KB Output is correct
46 Correct 1147 ms 154808 KB Output is correct
47 Correct 1303 ms 155064 KB Output is correct
48 Correct 971 ms 154752 KB Output is correct
49 Correct 929 ms 225000 KB Output is correct
50 Correct 720 ms 224992 KB Output is correct
51 Correct 1367 ms 155552 KB Output is correct
52 Correct 1061 ms 154792 KB Output is correct
53 Correct 1016 ms 154956 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 344 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 348 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 1 ms 604 KB Output is correct
69 Correct 0 ms 460 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 0 ms 452 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 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 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 448 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 348 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 348 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 1 ms 604 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 1 ms 348 KB Output is correct
102 Correct 1 ms 348 KB Output is correct
103 Correct 0 ms 344 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 1 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 604 KB Output is correct
110 Correct 10 ms 4300 KB Output is correct
111 Correct 14 ms 6488 KB Output is correct
112 Correct 33 ms 6620 KB Output is correct
113 Correct 16 ms 6744 KB Output is correct
114 Correct 11 ms 6492 KB Output is correct
115 Correct 13 ms 6492 KB Output is correct
116 Correct 21 ms 6940 KB Output is correct
117 Correct 14 ms 6488 KB Output is correct
118 Correct 14 ms 6620 KB Output is correct
119 Correct 38 ms 13920 KB Output is correct
120 Correct 73 ms 16124 KB Output is correct
121 Correct 47 ms 16160 KB Output is correct
122 Correct 36 ms 15700 KB Output is correct
123 Correct 35 ms 15708 KB Output is correct
124 Correct 147 ms 46128 KB Output is correct
125 Correct 833 ms 156612 KB Output is correct
126 Correct 1168 ms 155056 KB Output is correct
127 Correct 1069 ms 181436 KB Output is correct
128 Correct 497 ms 154404 KB Output is correct
129 Correct 493 ms 154436 KB Output is correct
130 Correct 1102 ms 182208 KB Output is correct
131 Correct 880 ms 180280 KB Output is correct
132 Correct 34 ms 6596 KB Output is correct
133 Correct 1 ms 604 KB Output is correct
134 Correct 1 ms 860 KB Output is correct
135 Correct 10 ms 4184 KB Output is correct
136 Correct 14 ms 7260 KB Output is correct
137 Correct 14 ms 6316 KB Output is correct
138 Correct 35 ms 6492 KB Output is correct
139 Correct 44 ms 6636 KB Output is correct
140 Correct 28 ms 6488 KB Output is correct
141 Correct 19 ms 6948 KB Output is correct
142 Correct 11 ms 6492 KB Output is correct
143 Correct 11 ms 6492 KB Output is correct
144 Correct 29 ms 9340 KB Output is correct
145 Correct 20 ms 9308 KB Output is correct
146 Correct 23 ms 7880 KB Output is correct
147 Correct 29 ms 6744 KB Output is correct
148 Correct 26 ms 6748 KB Output is correct
149 Correct 42 ms 6748 KB Output is correct
150 Correct 23 ms 6928 KB Output is correct
151 Correct 14 ms 6492 KB Output is correct
152 Correct 16 ms 6492 KB Output is correct
153 Correct 21 ms 6492 KB Output is correct
154 Correct 85 ms 15856 KB Output is correct
155 Correct 28 ms 8208 KB Output is correct
156 Correct 43 ms 13808 KB Output is correct
157 Correct 77 ms 14980 KB Output is correct
158 Correct 66 ms 15764 KB Output is correct
159 Correct 126 ms 15944 KB Output is correct
160 Correct 80 ms 15864 KB Output is correct
161 Correct 40 ms 16132 KB Output is correct
162 Correct 36 ms 15700 KB Output is correct
163 Correct 36 ms 15612 KB Output is correct
164 Correct 89 ms 22868 KB Output is correct
165 Correct 52 ms 22860 KB Output is correct
166 Correct 74 ms 19284 KB Output is correct
167 Correct 96 ms 16276 KB Output is correct
168 Correct 101 ms 16208 KB Output is correct
169 Correct 96 ms 16216 KB Output is correct
170 Correct 98 ms 16664 KB Output is correct
171 Correct 101 ms 16140 KB Output is correct
172 Correct 118 ms 15952 KB Output is correct
173 Correct 47 ms 15704 KB Output is correct
174 Correct 68 ms 21076 KB Output is correct
175 Correct 225 ms 35408 KB Output is correct
176 Correct 340 ms 90840 KB Output is correct
177 Correct 593 ms 105672 KB Output is correct
178 Correct 435 ms 136784 KB Output is correct
179 Correct 839 ms 156252 KB Output is correct
180 Correct 1156 ms 156404 KB Output is correct
181 Correct 1212 ms 156796 KB Output is correct
182 Correct 1409 ms 158068 KB Output is correct
183 Correct 1344 ms 159220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
7 Correct 1 ms 600 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 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 356 KB Output is correct
15 Correct 0 ms 348 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 348 KB Output is correct
19 Correct 29 ms 6456 KB Output is correct
20 Correct 14 ms 7256 KB Output is correct
21 Correct 34 ms 6488 KB Output is correct
22 Correct 43 ms 6644 KB Output is correct
23 Correct 27 ms 6740 KB Output is correct
24 Correct 28 ms 9308 KB Output is correct
25 Correct 19 ms 9308 KB Output is correct
26 Correct 14 ms 6492 KB Output is correct
27 Correct 14 ms 6704 KB Output is correct
28 Correct 21 ms 6768 KB Output is correct
29 Correct 92 ms 15952 KB Output is correct
30 Correct 25 ms 8024 KB Output is correct
31 Correct 72 ms 15948 KB Output is correct
32 Correct 125 ms 15708 KB Output is correct
33 Correct 81 ms 15704 KB Output is correct
34 Correct 92 ms 22884 KB Output is correct
35 Correct 54 ms 22856 KB Output is correct
36 Correct 98 ms 16148 KB Output is correct
37 Correct 114 ms 15876 KB Output is correct
38 Correct 41 ms 15804 KB Output is correct
39 Correct 1121 ms 154840 KB Output is correct
40 Correct 58 ms 18408 KB Output is correct
41 Correct 70 ms 27940 KB Output is correct
42 Correct 138 ms 22512 KB Output is correct
43 Correct 106 ms 30940 KB Output is correct
44 Correct 379 ms 82636 KB Output is correct
45 Correct 349 ms 90676 KB Output is correct
46 Correct 1147 ms 154808 KB Output is correct
47 Correct 1303 ms 155064 KB Output is correct
48 Correct 971 ms 154752 KB Output is correct
49 Correct 929 ms 225000 KB Output is correct
50 Correct 720 ms 224992 KB Output is correct
51 Correct 1367 ms 155552 KB Output is correct
52 Correct 1061 ms 154792 KB Output is correct
53 Correct 1016 ms 154956 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 344 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 348 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 1 ms 604 KB Output is correct
69 Correct 0 ms 460 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 0 ms 452 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 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 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 448 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 348 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 348 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 1 ms 604 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 1 ms 348 KB Output is correct
102 Correct 1 ms 348 KB Output is correct
103 Correct 0 ms 344 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 1 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 604 KB Output is correct
110 Correct 10 ms 4300 KB Output is correct
111 Correct 14 ms 6488 KB Output is correct
112 Correct 33 ms 6620 KB Output is correct
113 Correct 16 ms 6744 KB Output is correct
114 Correct 11 ms 6492 KB Output is correct
115 Correct 13 ms 6492 KB Output is correct
116 Correct 21 ms 6940 KB Output is correct
117 Correct 14 ms 6488 KB Output is correct
118 Correct 14 ms 6620 KB Output is correct
119 Correct 38 ms 13920 KB Output is correct
120 Correct 73 ms 16124 KB Output is correct
121 Correct 47 ms 16160 KB Output is correct
122 Correct 36 ms 15700 KB Output is correct
123 Correct 35 ms 15708 KB Output is correct
124 Correct 147 ms 46128 KB Output is correct
125 Correct 833 ms 156612 KB Output is correct
126 Correct 1168 ms 155056 KB Output is correct
127 Correct 1069 ms 181436 KB Output is correct
128 Correct 497 ms 154404 KB Output is correct
129 Correct 493 ms 154436 KB Output is correct
130 Correct 1102 ms 182208 KB Output is correct
131 Correct 880 ms 180280 KB Output is correct
132 Correct 34 ms 6596 KB Output is correct
133 Correct 1 ms 604 KB Output is correct
134 Correct 1 ms 860 KB Output is correct
135 Correct 10 ms 4184 KB Output is correct
136 Correct 14 ms 7260 KB Output is correct
137 Correct 14 ms 6316 KB Output is correct
138 Correct 35 ms 6492 KB Output is correct
139 Correct 44 ms 6636 KB Output is correct
140 Correct 28 ms 6488 KB Output is correct
141 Correct 19 ms 6948 KB Output is correct
142 Correct 11 ms 6492 KB Output is correct
143 Correct 11 ms 6492 KB Output is correct
144 Correct 29 ms 9340 KB Output is correct
145 Correct 20 ms 9308 KB Output is correct
146 Correct 23 ms 7880 KB Output is correct
147 Correct 29 ms 6744 KB Output is correct
148 Correct 26 ms 6748 KB Output is correct
149 Correct 42 ms 6748 KB Output is correct
150 Correct 23 ms 6928 KB Output is correct
151 Correct 14 ms 6492 KB Output is correct
152 Correct 16 ms 6492 KB Output is correct
153 Correct 21 ms 6492 KB Output is correct
154 Correct 85 ms 15856 KB Output is correct
155 Correct 28 ms 8208 KB Output is correct
156 Correct 43 ms 13808 KB Output is correct
157 Correct 77 ms 14980 KB Output is correct
158 Correct 66 ms 15764 KB Output is correct
159 Correct 126 ms 15944 KB Output is correct
160 Correct 80 ms 15864 KB Output is correct
161 Correct 40 ms 16132 KB Output is correct
162 Correct 36 ms 15700 KB Output is correct
163 Correct 36 ms 15612 KB Output is correct
164 Correct 89 ms 22868 KB Output is correct
165 Correct 52 ms 22860 KB Output is correct
166 Correct 74 ms 19284 KB Output is correct
167 Correct 96 ms 16276 KB Output is correct
168 Correct 101 ms 16208 KB Output is correct
169 Correct 96 ms 16216 KB Output is correct
170 Correct 98 ms 16664 KB Output is correct
171 Correct 101 ms 16140 KB Output is correct
172 Correct 118 ms 15952 KB Output is correct
173 Correct 47 ms 15704 KB Output is correct
174 Correct 68 ms 21076 KB Output is correct
175 Correct 225 ms 35408 KB Output is correct
176 Correct 340 ms 90840 KB Output is correct
177 Correct 593 ms 105672 KB Output is correct
178 Correct 435 ms 136784 KB Output is correct
179 Correct 839 ms 156252 KB Output is correct
180 Correct 1156 ms 156404 KB Output is correct
181 Correct 1212 ms 156796 KB Output is correct
182 Correct 1409 ms 158068 KB Output is correct
183 Correct 1344 ms 159220 KB Output is correct
184 Execution timed out 2064 ms 308720 KB Time limit exceeded
185 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 456 KB Output is correct
7 Correct 1 ms 600 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 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 356 KB Output is correct
15 Correct 0 ms 348 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 348 KB Output is correct
19 Correct 29 ms 6456 KB Output is correct
20 Correct 14 ms 7256 KB Output is correct
21 Correct 34 ms 6488 KB Output is correct
22 Correct 43 ms 6644 KB Output is correct
23 Correct 27 ms 6740 KB Output is correct
24 Correct 28 ms 9308 KB Output is correct
25 Correct 19 ms 9308 KB Output is correct
26 Correct 14 ms 6492 KB Output is correct
27 Correct 14 ms 6704 KB Output is correct
28 Correct 21 ms 6768 KB Output is correct
29 Correct 92 ms 15952 KB Output is correct
30 Correct 25 ms 8024 KB Output is correct
31 Correct 72 ms 15948 KB Output is correct
32 Correct 125 ms 15708 KB Output is correct
33 Correct 81 ms 15704 KB Output is correct
34 Correct 92 ms 22884 KB Output is correct
35 Correct 54 ms 22856 KB Output is correct
36 Correct 98 ms 16148 KB Output is correct
37 Correct 114 ms 15876 KB Output is correct
38 Correct 41 ms 15804 KB Output is correct
39 Correct 1121 ms 154840 KB Output is correct
40 Correct 58 ms 18408 KB Output is correct
41 Correct 70 ms 27940 KB Output is correct
42 Correct 138 ms 22512 KB Output is correct
43 Correct 106 ms 30940 KB Output is correct
44 Correct 379 ms 82636 KB Output is correct
45 Correct 349 ms 90676 KB Output is correct
46 Correct 1147 ms 154808 KB Output is correct
47 Correct 1303 ms 155064 KB Output is correct
48 Correct 971 ms 154752 KB Output is correct
49 Correct 929 ms 225000 KB Output is correct
50 Correct 720 ms 224992 KB Output is correct
51 Correct 1367 ms 155552 KB Output is correct
52 Correct 1061 ms 154792 KB Output is correct
53 Correct 1016 ms 154956 KB Output is correct
54 Correct 0 ms 344 KB Output is correct
55 Correct 1 ms 348 KB Output is correct
56 Correct 0 ms 348 KB Output is correct
57 Correct 0 ms 348 KB Output is correct
58 Correct 1 ms 344 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 348 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 0 ms 348 KB Output is correct
67 Correct 0 ms 344 KB Output is correct
68 Correct 1 ms 604 KB Output is correct
69 Correct 0 ms 460 KB Output is correct
70 Correct 1 ms 348 KB Output is correct
71 Correct 0 ms 452 KB Output is correct
72 Correct 1 ms 348 KB Output is correct
73 Correct 0 ms 348 KB Output is correct
74 Correct 0 ms 348 KB Output is correct
75 Correct 1 ms 348 KB Output is correct
76 Correct 1 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 0 ms 348 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 0 ms 348 KB Output is correct
82 Correct 0 ms 348 KB Output is correct
83 Correct 1 ms 348 KB Output is correct
84 Correct 1 ms 348 KB Output is correct
85 Correct 1 ms 348 KB Output is correct
86 Correct 0 ms 348 KB Output is correct
87 Correct 0 ms 348 KB Output is correct
88 Correct 0 ms 448 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 348 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 348 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 1 ms 604 KB Output is correct
98 Correct 0 ms 348 KB Output is correct
99 Correct 1 ms 348 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 1 ms 348 KB Output is correct
102 Correct 1 ms 348 KB Output is correct
103 Correct 0 ms 344 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 1 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 604 KB Output is correct
110 Correct 10 ms 4300 KB Output is correct
111 Correct 14 ms 6488 KB Output is correct
112 Correct 33 ms 6620 KB Output is correct
113 Correct 16 ms 6744 KB Output is correct
114 Correct 11 ms 6492 KB Output is correct
115 Correct 13 ms 6492 KB Output is correct
116 Correct 21 ms 6940 KB Output is correct
117 Correct 14 ms 6488 KB Output is correct
118 Correct 14 ms 6620 KB Output is correct
119 Correct 38 ms 13920 KB Output is correct
120 Correct 73 ms 16124 KB Output is correct
121 Correct 47 ms 16160 KB Output is correct
122 Correct 36 ms 15700 KB Output is correct
123 Correct 35 ms 15708 KB Output is correct
124 Correct 147 ms 46128 KB Output is correct
125 Correct 833 ms 156612 KB Output is correct
126 Correct 1168 ms 155056 KB Output is correct
127 Correct 1069 ms 181436 KB Output is correct
128 Correct 497 ms 154404 KB Output is correct
129 Correct 493 ms 154436 KB Output is correct
130 Correct 1102 ms 182208 KB Output is correct
131 Correct 880 ms 180280 KB Output is correct
132 Correct 34 ms 6596 KB Output is correct
133 Correct 1 ms 604 KB Output is correct
134 Correct 1 ms 860 KB Output is correct
135 Correct 10 ms 4184 KB Output is correct
136 Correct 14 ms 7260 KB Output is correct
137 Correct 14 ms 6316 KB Output is correct
138 Correct 35 ms 6492 KB Output is correct
139 Correct 44 ms 6636 KB Output is correct
140 Correct 28 ms 6488 KB Output is correct
141 Correct 19 ms 6948 KB Output is correct
142 Correct 11 ms 6492 KB Output is correct
143 Correct 11 ms 6492 KB Output is correct
144 Correct 29 ms 9340 KB Output is correct
145 Correct 20 ms 9308 KB Output is correct
146 Correct 23 ms 7880 KB Output is correct
147 Correct 29 ms 6744 KB Output is correct
148 Correct 26 ms 6748 KB Output is correct
149 Correct 42 ms 6748 KB Output is correct
150 Correct 23 ms 6928 KB Output is correct
151 Correct 14 ms 6492 KB Output is correct
152 Correct 16 ms 6492 KB Output is correct
153 Correct 21 ms 6492 KB Output is correct
154 Correct 85 ms 15856 KB Output is correct
155 Correct 28 ms 8208 KB Output is correct
156 Correct 43 ms 13808 KB Output is correct
157 Correct 77 ms 14980 KB Output is correct
158 Correct 66 ms 15764 KB Output is correct
159 Correct 126 ms 15944 KB Output is correct
160 Correct 80 ms 15864 KB Output is correct
161 Correct 40 ms 16132 KB Output is correct
162 Correct 36 ms 15700 KB Output is correct
163 Correct 36 ms 15612 KB Output is correct
164 Correct 89 ms 22868 KB Output is correct
165 Correct 52 ms 22860 KB Output is correct
166 Correct 74 ms 19284 KB Output is correct
167 Correct 96 ms 16276 KB Output is correct
168 Correct 101 ms 16208 KB Output is correct
169 Correct 96 ms 16216 KB Output is correct
170 Correct 98 ms 16664 KB Output is correct
171 Correct 101 ms 16140 KB Output is correct
172 Correct 118 ms 15952 KB Output is correct
173 Correct 47 ms 15704 KB Output is correct
174 Correct 68 ms 21076 KB Output is correct
175 Correct 225 ms 35408 KB Output is correct
176 Correct 340 ms 90840 KB Output is correct
177 Correct 593 ms 105672 KB Output is correct
178 Correct 435 ms 136784 KB Output is correct
179 Correct 839 ms 156252 KB Output is correct
180 Correct 1156 ms 156404 KB Output is correct
181 Correct 1212 ms 156796 KB Output is correct
182 Correct 1409 ms 158068 KB Output is correct
183 Correct 1344 ms 159220 KB Output is correct
184 Execution timed out 2064 ms 308720 KB Time limit exceeded
185 Halted 0 ms 0 KB -