답안 #578513

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
578513 2022-06-17T07:48:04 Z 8e7 화성 (APIO22_mars) C++17
100 / 100
1405 ms 4644 KB
//Challenge: Accepted
//#define _GLIBCXX_DEBUG 1
#include <bits/stdc++.h>
#include "mars.h"
#pragma GCC optimize("Ofast")
using namespace std;
#ifdef zisk
void debug(){cout << endl;}
template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
	while (l != r) cout << *l << " ", l++;
	cout << endl;
}
#else
#define debug(...) 0
#define pary(...) 0
#endif
#define ll long long
#define maxn 85
#define pii pair<int, int>
#define ff first
#define ss second
const int inf = 1<<30;

bool vis[3 * maxn];
int color[3 * maxn];
vector<int> adj[3 * maxn];

void dfs(int n, int c) {
	vis[n] = 1;
	color[n] = c;
	for (int v:adj[n]) {
		if (!vis[v]) dfs(v, c);
	}
}

std::string process(std::vector <std::vector<std::string>> a, int X, int Y, int k, int n) {
	int len = 2 * n + 1, m = len - 2 * k - 3;
	string ret = a[0][0];

	auto propagate = [&] (bool type) {
		if (type) {
			ret[1] = a[1][0][0];	
			for (int i = 2;i < 100;i++) ret[i] = a[2][0][i-2];
		} else {
			ret[1] = a[0][1][0];	
			for (int i = 2;i < 100;i++) ret[i] = a[0][2][i-2];
		}
	};
	if (X < m-1 && Y < m-1) {
		return ret;
	} else if (X < m && Y < m) {
		if (X == m - 1 && Y == m - 1) {
			int l = 1 + 2 * k;		
			string s;
			for (int i = 0;i < l;i++) s += a[2][1][i];
			reverse(s.begin(), s.end());
			s += a[1][1][0];
			for (int i = 0;i < l;i++) s += a[1][2][i];
			for (int i = 0;i < s.size();i++) ret[i] = s[i];
			ret[99] = a[0][0][0];
		} else {
			propagate(X == m-1);
		}
	} else if (X == m && Y == m) {

		for (int i = 0;i < 3 * maxn;i++) adj[i].clear(), vis[i] = 0, color[i] = 0;

		int l = 1 + 2 * k;	

		int cnt = 0; //the number of lone islands 
		for (int i = 83;i < 98;i++) cnt += (1<<(i-83)) * (a[2][2][i] - '0');
		string s, t, mid; // s is current row, t is row for previous iter

		if (k == 0) {
			s = a[2][0][0]; s += a[1][0][0];s += a[0][0][0];s += a[0][1][0];s += a[0][2][0];
			mid = a[2][1][0]; mid += a[1][1][0];mid += a[1][2][0];
			t = a[2][2][0];
		} else {
			for (int i = 0;i < l;i++) s += a[2][0][i];	
			reverse(s.begin(), s.end());
			s += a[1][0][0];
			s += a[0][0][0];
			s += a[0][1][0];
			for (int i = 0;i < l;i++) s += a[0][2][i];	

			for (int i = 0;i < l;i++) mid += a[2][1][i];
			reverse(mid.begin(), mid.end());
			mid += a[1][1][99];
			for (int i = 0;i < l;i++) mid += a[1][2][i];


			t += a[2][2][98];	
			for (int i = 0;i < 2 * (l - 2) + 1;i++) t += a[1][1][i];
			t += a[2][2][99];	
		}

		ret[98] = s[0];
		ret[99] = s.back();

		//parse component info for t	
		vector<int> comp(maxn, 0), last(maxn, -1);
		vector<int> seg;
		if (k > 0) {
			int cur = 0, prv = 0;
			for (char i:t) {
				if (i == '1' && prv == 0) cur++;
				if (i == '1') seg.push_back(cur);
				else seg.push_back(0);
				prv = i - '0';
			}	
			//cur is number of components
			stack<int> stk;
			for (int i = 0;i < 2 * cur;i += 2) {
				int type = (a[2][2][i] - '0') + (a[2][2][i+1] - '0') * 2;
				if (type == 0) comp[i/2+1] = i/2+1;
				else if (type == 1) {
					comp[i/2+1] = i/2+1;
					stk.push(i/2+1);
				} else if (type == 2) {
					comp[i/2+1] = stk.top();
					stk.pop();
				} else {
					comp[i/2+1] = stk.top();
				}
			}
		}
		//build graph
		auto addedge = [&] (int u, int v) {
			adj[u].push_back(v);
			adj[v].push_back(u);	
		};
		auto check = [&] (int u, int v, char c, char d) {
			if (c == '1' && d == '1') addedge(u, v);
		};
		if (k > 0) {
			for (int i = 0;i < t.size();i++) {
				if (t[i] == '1') {
					seg[i] = comp[seg[i]];		
					if (last[seg[i]] != -1) {
						addedge(i, last[seg[i]]);
					}
					last[seg[i]] = i;
				}
			}
		}
		for (int i = 0;i < l;i++) check(i, maxn+i, t[i], mid[i]);	
		for (int i = 0;i <= l;i++) check(maxn+i, 2*maxn+i, mid[i], s[i]);	
		for (int i = l-1;i < 2*l - 1;i++) check(i, maxn+i+2, t[i], mid[i+2]);	
		for (int i = l;i < 2*l + 1;i++) check(maxn+i, 2*maxn+i+2, mid[i], s[i+2]);	

		for (int i = 1;i < 2 * l+3;i++) {
			if (i < 2*l - 1) check(i-1, i, t[i-1], t[i]);	
			if (i < 2*l + 1) check(maxn + i-1, maxn + i, mid[i-1], mid[i]);	
			check(2*maxn + i-1, 2*maxn + i, s[i-1], s[i]);	
		}
		

		int upper = 0;
		{
			int cur = 0;
			for (int i = 0;i < 2 * l + 3;i++) {
				if (s[i] == '1' && !vis[2*maxn + i]) {
					cur++;
					dfs(2*maxn + i, cur);
				}
			}
			upper = cur;
		}
		
		for (int i = 0;i < 2 * l + 1;i++) {
			if (mid[i] == '1' && !vis[maxn + i]) {
				cnt++;
				dfs(maxn + i, 0);
			}
		}
		for (int i = 0;i < 2 * l - 1;i++) {
			if (t[i] == '1' && !vis[i]) {
				cnt++;
				dfs(i, 0);
			}
		}
		
		if (k == n-1) {
			upper += cnt;
			for (int i = 0;i < 100;i++) ret[i] = '0';
			for (int i = 0;i < 100;i++) ret[i] = '0';
			for (int i = 0;i < 20;i++) {
				ret[i] = ((upper>>i) & 1) + '0';
			}
			return ret;
		}
		//encodes component info
		{
			int prv = 0;
			vector<pii> vec;
			vector<int> st(maxn, inf), en(maxn, -1);
			for (int i = 0;i < 2 * l+3;i++) {
				if (s[i] == '1' && prv == 0) {
					int c = color[2*maxn+i];
					vec.push_back({c, i});
					st[c] = min(st[c], i);
					en[c] = max(en[c], i);
				}
				prv = s[i] - '0';
			}
			int idx = 0;
			for (auto [c, i]:vec) {
				if (i == st[c] && i == en[c]) {
					ret[idx] = '0', ret[idx+1] = '0';	
				} else if (i == st[c]) {
					ret[idx] = '1', ret[idx+1] = '0';
				} else if (i == en[c]) {
					ret[idx] = '0', ret[idx+1] = '1';
				} else {
					ret[idx] = '1', ret[idx+1] = '1';
				}
				idx += 2;
			}
		}
		
		//encodes cnt
		for (int i = 83;i < 98;i++) {
			ret[i] = ((cnt>>(i-83)) & 1) + '0';
		}

	} else {
		propagate(X == m);
	}
	return ret;
}

Compilation message

mars.cpp: In function 'std::string process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:60:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |    for (int i = 0;i < s.size();i++) ret[i] = s[i];
      |                   ~~^~~~~~~~~~
mars.cpp:137:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  137 |    for (int i = 0;i < t.size();i++) {
      |                   ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1900 KB Output is correct
2 Correct 8 ms 2188 KB Output is correct
3 Correct 8 ms 2068 KB Output is correct
4 Correct 8 ms 1960 KB Output is correct
5 Correct 8 ms 2128 KB Output is correct
6 Correct 8 ms 1904 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1900 KB Output is correct
2 Correct 8 ms 2188 KB Output is correct
3 Correct 8 ms 2068 KB Output is correct
4 Correct 8 ms 1960 KB Output is correct
5 Correct 8 ms 2128 KB Output is correct
6 Correct 8 ms 1904 KB Output is correct
7 Correct 12 ms 2108 KB Output is correct
8 Correct 17 ms 2124 KB Output is correct
9 Correct 16 ms 2332 KB Output is correct
10 Correct 16 ms 2172 KB Output is correct
11 Correct 16 ms 2264 KB Output is correct
12 Correct 16 ms 2088 KB Output is correct
13 Correct 16 ms 2200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1900 KB Output is correct
2 Correct 8 ms 2188 KB Output is correct
3 Correct 8 ms 2068 KB Output is correct
4 Correct 8 ms 1960 KB Output is correct
5 Correct 8 ms 2128 KB Output is correct
6 Correct 8 ms 1904 KB Output is correct
7 Correct 12 ms 2108 KB Output is correct
8 Correct 17 ms 2124 KB Output is correct
9 Correct 16 ms 2332 KB Output is correct
10 Correct 16 ms 2172 KB Output is correct
11 Correct 16 ms 2264 KB Output is correct
12 Correct 16 ms 2088 KB Output is correct
13 Correct 16 ms 2200 KB Output is correct
14 Correct 30 ms 2476 KB Output is correct
15 Correct 44 ms 2616 KB Output is correct
16 Correct 42 ms 2596 KB Output is correct
17 Correct 43 ms 2584 KB Output is correct
18 Correct 43 ms 2640 KB Output is correct
19 Correct 41 ms 2648 KB Output is correct
20 Correct 45 ms 2564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1900 KB Output is correct
2 Correct 8 ms 2188 KB Output is correct
3 Correct 8 ms 2068 KB Output is correct
4 Correct 8 ms 1960 KB Output is correct
5 Correct 8 ms 2128 KB Output is correct
6 Correct 8 ms 1904 KB Output is correct
7 Correct 12 ms 2108 KB Output is correct
8 Correct 17 ms 2124 KB Output is correct
9 Correct 16 ms 2332 KB Output is correct
10 Correct 16 ms 2172 KB Output is correct
11 Correct 16 ms 2264 KB Output is correct
12 Correct 16 ms 2088 KB Output is correct
13 Correct 16 ms 2200 KB Output is correct
14 Correct 30 ms 2476 KB Output is correct
15 Correct 44 ms 2616 KB Output is correct
16 Correct 42 ms 2596 KB Output is correct
17 Correct 43 ms 2584 KB Output is correct
18 Correct 43 ms 2640 KB Output is correct
19 Correct 41 ms 2648 KB Output is correct
20 Correct 45 ms 2564 KB Output is correct
21 Correct 65 ms 2588 KB Output is correct
22 Correct 93 ms 2712 KB Output is correct
23 Correct 93 ms 2716 KB Output is correct
24 Correct 91 ms 2728 KB Output is correct
25 Correct 95 ms 2720 KB Output is correct
26 Correct 92 ms 2708 KB Output is correct
27 Correct 96 ms 2692 KB Output is correct
28 Correct 94 ms 2832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1900 KB Output is correct
2 Correct 8 ms 2188 KB Output is correct
3 Correct 8 ms 2068 KB Output is correct
4 Correct 8 ms 1960 KB Output is correct
5 Correct 8 ms 2128 KB Output is correct
6 Correct 8 ms 1904 KB Output is correct
7 Correct 12 ms 2108 KB Output is correct
8 Correct 17 ms 2124 KB Output is correct
9 Correct 16 ms 2332 KB Output is correct
10 Correct 16 ms 2172 KB Output is correct
11 Correct 16 ms 2264 KB Output is correct
12 Correct 16 ms 2088 KB Output is correct
13 Correct 16 ms 2200 KB Output is correct
14 Correct 30 ms 2476 KB Output is correct
15 Correct 44 ms 2616 KB Output is correct
16 Correct 42 ms 2596 KB Output is correct
17 Correct 43 ms 2584 KB Output is correct
18 Correct 43 ms 2640 KB Output is correct
19 Correct 41 ms 2648 KB Output is correct
20 Correct 45 ms 2564 KB Output is correct
21 Correct 65 ms 2588 KB Output is correct
22 Correct 93 ms 2712 KB Output is correct
23 Correct 93 ms 2716 KB Output is correct
24 Correct 91 ms 2728 KB Output is correct
25 Correct 95 ms 2720 KB Output is correct
26 Correct 92 ms 2708 KB Output is correct
27 Correct 96 ms 2692 KB Output is correct
28 Correct 94 ms 2832 KB Output is correct
29 Correct 138 ms 2792 KB Output is correct
30 Correct 189 ms 2868 KB Output is correct
31 Correct 174 ms 2896 KB Output is correct
32 Correct 177 ms 2892 KB Output is correct
33 Correct 181 ms 2908 KB Output is correct
34 Correct 188 ms 2972 KB Output is correct
35 Correct 176 ms 2928 KB Output is correct
36 Correct 183 ms 2876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1900 KB Output is correct
2 Correct 8 ms 2188 KB Output is correct
3 Correct 8 ms 2068 KB Output is correct
4 Correct 8 ms 1960 KB Output is correct
5 Correct 8 ms 2128 KB Output is correct
6 Correct 8 ms 1904 KB Output is correct
7 Correct 12 ms 2108 KB Output is correct
8 Correct 17 ms 2124 KB Output is correct
9 Correct 16 ms 2332 KB Output is correct
10 Correct 16 ms 2172 KB Output is correct
11 Correct 16 ms 2264 KB Output is correct
12 Correct 16 ms 2088 KB Output is correct
13 Correct 16 ms 2200 KB Output is correct
14 Correct 30 ms 2476 KB Output is correct
15 Correct 44 ms 2616 KB Output is correct
16 Correct 42 ms 2596 KB Output is correct
17 Correct 43 ms 2584 KB Output is correct
18 Correct 43 ms 2640 KB Output is correct
19 Correct 41 ms 2648 KB Output is correct
20 Correct 45 ms 2564 KB Output is correct
21 Correct 65 ms 2588 KB Output is correct
22 Correct 93 ms 2712 KB Output is correct
23 Correct 93 ms 2716 KB Output is correct
24 Correct 91 ms 2728 KB Output is correct
25 Correct 95 ms 2720 KB Output is correct
26 Correct 92 ms 2708 KB Output is correct
27 Correct 96 ms 2692 KB Output is correct
28 Correct 94 ms 2832 KB Output is correct
29 Correct 138 ms 2792 KB Output is correct
30 Correct 189 ms 2868 KB Output is correct
31 Correct 174 ms 2896 KB Output is correct
32 Correct 177 ms 2892 KB Output is correct
33 Correct 181 ms 2908 KB Output is correct
34 Correct 188 ms 2972 KB Output is correct
35 Correct 176 ms 2928 KB Output is correct
36 Correct 183 ms 2876 KB Output is correct
37 Correct 230 ms 3236 KB Output is correct
38 Correct 311 ms 3296 KB Output is correct
39 Correct 295 ms 3292 KB Output is correct
40 Correct 314 ms 3264 KB Output is correct
41 Correct 304 ms 3256 KB Output is correct
42 Correct 307 ms 3292 KB Output is correct
43 Correct 290 ms 3292 KB Output is correct
44 Correct 297 ms 3348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1900 KB Output is correct
2 Correct 8 ms 2188 KB Output is correct
3 Correct 8 ms 2068 KB Output is correct
4 Correct 8 ms 1960 KB Output is correct
5 Correct 8 ms 2128 KB Output is correct
6 Correct 8 ms 1904 KB Output is correct
7 Correct 12 ms 2108 KB Output is correct
8 Correct 17 ms 2124 KB Output is correct
9 Correct 16 ms 2332 KB Output is correct
10 Correct 16 ms 2172 KB Output is correct
11 Correct 16 ms 2264 KB Output is correct
12 Correct 16 ms 2088 KB Output is correct
13 Correct 16 ms 2200 KB Output is correct
14 Correct 30 ms 2476 KB Output is correct
15 Correct 44 ms 2616 KB Output is correct
16 Correct 42 ms 2596 KB Output is correct
17 Correct 43 ms 2584 KB Output is correct
18 Correct 43 ms 2640 KB Output is correct
19 Correct 41 ms 2648 KB Output is correct
20 Correct 45 ms 2564 KB Output is correct
21 Correct 65 ms 2588 KB Output is correct
22 Correct 93 ms 2712 KB Output is correct
23 Correct 93 ms 2716 KB Output is correct
24 Correct 91 ms 2728 KB Output is correct
25 Correct 95 ms 2720 KB Output is correct
26 Correct 92 ms 2708 KB Output is correct
27 Correct 96 ms 2692 KB Output is correct
28 Correct 94 ms 2832 KB Output is correct
29 Correct 138 ms 2792 KB Output is correct
30 Correct 189 ms 2868 KB Output is correct
31 Correct 174 ms 2896 KB Output is correct
32 Correct 177 ms 2892 KB Output is correct
33 Correct 181 ms 2908 KB Output is correct
34 Correct 188 ms 2972 KB Output is correct
35 Correct 176 ms 2928 KB Output is correct
36 Correct 183 ms 2876 KB Output is correct
37 Correct 230 ms 3236 KB Output is correct
38 Correct 311 ms 3296 KB Output is correct
39 Correct 295 ms 3292 KB Output is correct
40 Correct 314 ms 3264 KB Output is correct
41 Correct 304 ms 3256 KB Output is correct
42 Correct 307 ms 3292 KB Output is correct
43 Correct 290 ms 3292 KB Output is correct
44 Correct 297 ms 3348 KB Output is correct
45 Correct 381 ms 3432 KB Output is correct
46 Correct 470 ms 3476 KB Output is correct
47 Correct 472 ms 3436 KB Output is correct
48 Correct 492 ms 3456 KB Output is correct
49 Correct 468 ms 3484 KB Output is correct
50 Correct 468 ms 3572 KB Output is correct
51 Correct 455 ms 3492 KB Output is correct
52 Correct 453 ms 3476 KB Output is correct
53 Correct 457 ms 3432 KB Output is correct
54 Correct 472 ms 3480 KB Output is correct
55 Correct 460 ms 3448 KB Output is correct
56 Correct 451 ms 3496 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1900 KB Output is correct
2 Correct 8 ms 2188 KB Output is correct
3 Correct 8 ms 2068 KB Output is correct
4 Correct 8 ms 1960 KB Output is correct
5 Correct 8 ms 2128 KB Output is correct
6 Correct 8 ms 1904 KB Output is correct
7 Correct 12 ms 2108 KB Output is correct
8 Correct 17 ms 2124 KB Output is correct
9 Correct 16 ms 2332 KB Output is correct
10 Correct 16 ms 2172 KB Output is correct
11 Correct 16 ms 2264 KB Output is correct
12 Correct 16 ms 2088 KB Output is correct
13 Correct 16 ms 2200 KB Output is correct
14 Correct 30 ms 2476 KB Output is correct
15 Correct 44 ms 2616 KB Output is correct
16 Correct 42 ms 2596 KB Output is correct
17 Correct 43 ms 2584 KB Output is correct
18 Correct 43 ms 2640 KB Output is correct
19 Correct 41 ms 2648 KB Output is correct
20 Correct 45 ms 2564 KB Output is correct
21 Correct 65 ms 2588 KB Output is correct
22 Correct 93 ms 2712 KB Output is correct
23 Correct 93 ms 2716 KB Output is correct
24 Correct 91 ms 2728 KB Output is correct
25 Correct 95 ms 2720 KB Output is correct
26 Correct 92 ms 2708 KB Output is correct
27 Correct 96 ms 2692 KB Output is correct
28 Correct 94 ms 2832 KB Output is correct
29 Correct 138 ms 2792 KB Output is correct
30 Correct 189 ms 2868 KB Output is correct
31 Correct 174 ms 2896 KB Output is correct
32 Correct 177 ms 2892 KB Output is correct
33 Correct 181 ms 2908 KB Output is correct
34 Correct 188 ms 2972 KB Output is correct
35 Correct 176 ms 2928 KB Output is correct
36 Correct 183 ms 2876 KB Output is correct
37 Correct 230 ms 3236 KB Output is correct
38 Correct 311 ms 3296 KB Output is correct
39 Correct 295 ms 3292 KB Output is correct
40 Correct 314 ms 3264 KB Output is correct
41 Correct 304 ms 3256 KB Output is correct
42 Correct 307 ms 3292 KB Output is correct
43 Correct 290 ms 3292 KB Output is correct
44 Correct 297 ms 3348 KB Output is correct
45 Correct 381 ms 3432 KB Output is correct
46 Correct 470 ms 3476 KB Output is correct
47 Correct 472 ms 3436 KB Output is correct
48 Correct 492 ms 3456 KB Output is correct
49 Correct 468 ms 3484 KB Output is correct
50 Correct 468 ms 3572 KB Output is correct
51 Correct 455 ms 3492 KB Output is correct
52 Correct 453 ms 3476 KB Output is correct
53 Correct 457 ms 3432 KB Output is correct
54 Correct 472 ms 3480 KB Output is correct
55 Correct 460 ms 3448 KB Output is correct
56 Correct 451 ms 3496 KB Output is correct
57 Correct 586 ms 4064 KB Output is correct
58 Correct 691 ms 4100 KB Output is correct
59 Correct 711 ms 4152 KB Output is correct
60 Correct 679 ms 4156 KB Output is correct
61 Correct 673 ms 4168 KB Output is correct
62 Correct 672 ms 4088 KB Output is correct
63 Correct 717 ms 4084 KB Output is correct
64 Correct 690 ms 4052 KB Output is correct
65 Correct 690 ms 4252 KB Output is correct
66 Correct 639 ms 4172 KB Output is correct
67 Correct 667 ms 4136 KB Output is correct
68 Correct 691 ms 4240 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1900 KB Output is correct
2 Correct 8 ms 2188 KB Output is correct
3 Correct 8 ms 2068 KB Output is correct
4 Correct 8 ms 1960 KB Output is correct
5 Correct 8 ms 2128 KB Output is correct
6 Correct 8 ms 1904 KB Output is correct
7 Correct 12 ms 2108 KB Output is correct
8 Correct 17 ms 2124 KB Output is correct
9 Correct 16 ms 2332 KB Output is correct
10 Correct 16 ms 2172 KB Output is correct
11 Correct 16 ms 2264 KB Output is correct
12 Correct 16 ms 2088 KB Output is correct
13 Correct 16 ms 2200 KB Output is correct
14 Correct 30 ms 2476 KB Output is correct
15 Correct 44 ms 2616 KB Output is correct
16 Correct 42 ms 2596 KB Output is correct
17 Correct 43 ms 2584 KB Output is correct
18 Correct 43 ms 2640 KB Output is correct
19 Correct 41 ms 2648 KB Output is correct
20 Correct 45 ms 2564 KB Output is correct
21 Correct 65 ms 2588 KB Output is correct
22 Correct 93 ms 2712 KB Output is correct
23 Correct 93 ms 2716 KB Output is correct
24 Correct 91 ms 2728 KB Output is correct
25 Correct 95 ms 2720 KB Output is correct
26 Correct 92 ms 2708 KB Output is correct
27 Correct 96 ms 2692 KB Output is correct
28 Correct 94 ms 2832 KB Output is correct
29 Correct 138 ms 2792 KB Output is correct
30 Correct 189 ms 2868 KB Output is correct
31 Correct 174 ms 2896 KB Output is correct
32 Correct 177 ms 2892 KB Output is correct
33 Correct 181 ms 2908 KB Output is correct
34 Correct 188 ms 2972 KB Output is correct
35 Correct 176 ms 2928 KB Output is correct
36 Correct 183 ms 2876 KB Output is correct
37 Correct 230 ms 3236 KB Output is correct
38 Correct 311 ms 3296 KB Output is correct
39 Correct 295 ms 3292 KB Output is correct
40 Correct 314 ms 3264 KB Output is correct
41 Correct 304 ms 3256 KB Output is correct
42 Correct 307 ms 3292 KB Output is correct
43 Correct 290 ms 3292 KB Output is correct
44 Correct 297 ms 3348 KB Output is correct
45 Correct 381 ms 3432 KB Output is correct
46 Correct 470 ms 3476 KB Output is correct
47 Correct 472 ms 3436 KB Output is correct
48 Correct 492 ms 3456 KB Output is correct
49 Correct 468 ms 3484 KB Output is correct
50 Correct 468 ms 3572 KB Output is correct
51 Correct 455 ms 3492 KB Output is correct
52 Correct 453 ms 3476 KB Output is correct
53 Correct 457 ms 3432 KB Output is correct
54 Correct 472 ms 3480 KB Output is correct
55 Correct 460 ms 3448 KB Output is correct
56 Correct 451 ms 3496 KB Output is correct
57 Correct 586 ms 4064 KB Output is correct
58 Correct 691 ms 4100 KB Output is correct
59 Correct 711 ms 4152 KB Output is correct
60 Correct 679 ms 4156 KB Output is correct
61 Correct 673 ms 4168 KB Output is correct
62 Correct 672 ms 4088 KB Output is correct
63 Correct 717 ms 4084 KB Output is correct
64 Correct 690 ms 4052 KB Output is correct
65 Correct 690 ms 4252 KB Output is correct
66 Correct 639 ms 4172 KB Output is correct
67 Correct 667 ms 4136 KB Output is correct
68 Correct 691 ms 4240 KB Output is correct
69 Correct 856 ms 4200 KB Output is correct
70 Correct 1045 ms 4260 KB Output is correct
71 Correct 1010 ms 4208 KB Output is correct
72 Correct 1026 ms 4244 KB Output is correct
73 Correct 1026 ms 4228 KB Output is correct
74 Correct 1016 ms 4240 KB Output is correct
75 Correct 1034 ms 4292 KB Output is correct
76 Correct 981 ms 4220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1900 KB Output is correct
2 Correct 8 ms 2188 KB Output is correct
3 Correct 8 ms 2068 KB Output is correct
4 Correct 8 ms 1960 KB Output is correct
5 Correct 8 ms 2128 KB Output is correct
6 Correct 8 ms 1904 KB Output is correct
7 Correct 12 ms 2108 KB Output is correct
8 Correct 17 ms 2124 KB Output is correct
9 Correct 16 ms 2332 KB Output is correct
10 Correct 16 ms 2172 KB Output is correct
11 Correct 16 ms 2264 KB Output is correct
12 Correct 16 ms 2088 KB Output is correct
13 Correct 16 ms 2200 KB Output is correct
14 Correct 30 ms 2476 KB Output is correct
15 Correct 44 ms 2616 KB Output is correct
16 Correct 42 ms 2596 KB Output is correct
17 Correct 43 ms 2584 KB Output is correct
18 Correct 43 ms 2640 KB Output is correct
19 Correct 41 ms 2648 KB Output is correct
20 Correct 45 ms 2564 KB Output is correct
21 Correct 65 ms 2588 KB Output is correct
22 Correct 93 ms 2712 KB Output is correct
23 Correct 93 ms 2716 KB Output is correct
24 Correct 91 ms 2728 KB Output is correct
25 Correct 95 ms 2720 KB Output is correct
26 Correct 92 ms 2708 KB Output is correct
27 Correct 96 ms 2692 KB Output is correct
28 Correct 94 ms 2832 KB Output is correct
29 Correct 138 ms 2792 KB Output is correct
30 Correct 189 ms 2868 KB Output is correct
31 Correct 174 ms 2896 KB Output is correct
32 Correct 177 ms 2892 KB Output is correct
33 Correct 181 ms 2908 KB Output is correct
34 Correct 188 ms 2972 KB Output is correct
35 Correct 176 ms 2928 KB Output is correct
36 Correct 183 ms 2876 KB Output is correct
37 Correct 230 ms 3236 KB Output is correct
38 Correct 311 ms 3296 KB Output is correct
39 Correct 295 ms 3292 KB Output is correct
40 Correct 314 ms 3264 KB Output is correct
41 Correct 304 ms 3256 KB Output is correct
42 Correct 307 ms 3292 KB Output is correct
43 Correct 290 ms 3292 KB Output is correct
44 Correct 297 ms 3348 KB Output is correct
45 Correct 381 ms 3432 KB Output is correct
46 Correct 470 ms 3476 KB Output is correct
47 Correct 472 ms 3436 KB Output is correct
48 Correct 492 ms 3456 KB Output is correct
49 Correct 468 ms 3484 KB Output is correct
50 Correct 468 ms 3572 KB Output is correct
51 Correct 455 ms 3492 KB Output is correct
52 Correct 453 ms 3476 KB Output is correct
53 Correct 457 ms 3432 KB Output is correct
54 Correct 472 ms 3480 KB Output is correct
55 Correct 460 ms 3448 KB Output is correct
56 Correct 451 ms 3496 KB Output is correct
57 Correct 586 ms 4064 KB Output is correct
58 Correct 691 ms 4100 KB Output is correct
59 Correct 711 ms 4152 KB Output is correct
60 Correct 679 ms 4156 KB Output is correct
61 Correct 673 ms 4168 KB Output is correct
62 Correct 672 ms 4088 KB Output is correct
63 Correct 717 ms 4084 KB Output is correct
64 Correct 690 ms 4052 KB Output is correct
65 Correct 690 ms 4252 KB Output is correct
66 Correct 639 ms 4172 KB Output is correct
67 Correct 667 ms 4136 KB Output is correct
68 Correct 691 ms 4240 KB Output is correct
69 Correct 856 ms 4200 KB Output is correct
70 Correct 1045 ms 4260 KB Output is correct
71 Correct 1010 ms 4208 KB Output is correct
72 Correct 1026 ms 4244 KB Output is correct
73 Correct 1026 ms 4228 KB Output is correct
74 Correct 1016 ms 4240 KB Output is correct
75 Correct 1034 ms 4292 KB Output is correct
76 Correct 981 ms 4220 KB Output is correct
77 Correct 1019 ms 4452 KB Output is correct
78 Correct 1382 ms 4616 KB Output is correct
79 Correct 1378 ms 4600 KB Output is correct
80 Correct 1376 ms 4572 KB Output is correct
81 Correct 1372 ms 4612 KB Output is correct
82 Correct 1389 ms 4576 KB Output is correct
83 Correct 1405 ms 4644 KB Output is correct
84 Correct 1373 ms 4600 KB Output is correct