답안 #975454

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975454 2024-05-05T08:17:40 Z oolimry 화성 (APIO22_mars) C++17
100 / 100
1891 ms 7768 KB
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (int) (x).size()
#define all(x) (x).begin(), (x).end()
#define show(x) cerr << #x << " is " << x << endl;
#define show2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl;
#define show3(x,y,z) cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl;
#define showlist(x) cerr << #x << " is "; for(auto p : x) cerr << p << " "; cerr << endl;
typedef pair<int,int> ii;
 
const int CNTBUFFER = 10;
const int GROUPBUFFER = 55;

///attempt 4: push into 5x5 and then see how from there
/// stuff for dfs
int grid[45][45];
int ccCounter = 1;
map<ii, vector<ii> > adj;
void resetgrid(){
	ccCounter = 1;
	adj.clear();
	for(int i = 0;i < 45;i++) for(int j = 0;j < 45;j++) grid[i][j] = 0;
}

void dfs(int i, int j){
	if(i < 0 or j < 0) return;
	if(grid[i][j] != -1) return;
	
	grid[i][j] = ccCounter;
	
	for(ii a : adj[ii(i,j)]) dfs(a.first, a.second);
	dfs(i+1,j);
	dfs(i-1,j);
	dfs(i,j+1);
	dfs(i,j-1);
}

void orTo(string &a, string b){
	for(int p = 0;p < 100;p++){
		if(b[p] == '1') a[p] = '1';
	}
}

int n, K;
ii group(int i, int j, int k){
	vector<int> things = {};
	for(int i = 0;i <= 2*n - 2*k;i++) things.push_back((i*5) / (2*n - 2*k+1));
	sort(all(things));
	
	//int sqsize = (5 + 2*n - 2*k) / 5;
	//if(i == 2 and j == 2) show2(k, sqsize);
	int G = things[i]*10 + things[j]; //((i) / sqsize) * 10 + (j) / sqsize;
	int P = ((i) % 10) * 10 + ((j)%10);
	return {G,P};
}

string writeNumber(int cnt){
	string res = string(100,'0');
	for(int p = 0;p < 100;p++){
		if(cnt % 2 == 1) res[p] = '1';
		cnt /= 2;
	}
	return res;
}


pair<int, vector<int> > decode(string res){
	int internalComponents = 0;
	
	for(int b = 0;b < CNTBUFFER;b++){
		if(res[b] == '1') internalComponents += (1LL <<b);
	}
	
	int b = CNTBUFFER;
	vector<int> colors;
	
	for(int i = 0;i <= 2*n;i++){
		colors.push_back(res[b] - '0');
		b++;
	}
	
	vector<vector<int> > groups;
	
	int pre = -1;
	for(int i = 0;i <= 2*n;i++){
		if(colors[i] == 1 ){
			if(pre != 1) groups.push_back({});
			groups.back().push_back(i);
		}
		
		pre = colors[i];
	}
	
	vector<int> S;
	b = GROUPBUFFER;
	int cnt = 1;
	
	for(auto &v : groups){
		if(res[b] == '1') S.push_back(cnt++);
		b++;
		
		for(int i : v) colors[i] = S.back();
		
		if(res[b] == '1') S.pop_back();
		b++;
	}
	
	
	return {internalComponents, colors};
}

string generateCorner(vector<vector<int> > g){
	/*
	for(auto v : g){
		for(int x : v) cerr << x << " ";
		cerr << endl;
	}
	cerr << endl;
	//*/
	
	int internalComponents = 0;
	
	resetgrid();
	
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= n;j++){
			grid[i][j] = -g[i][j];
		}
	}
	
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= n;j++){
			if(grid[i][j] == -1){
				dfs(i,j);
				ccCounter++;
			}
		}
	}
	//*
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= n;j++){
			cerr << grid[i][j] << " ";
		}
		cerr << endl;
	}
	
	//*/
	
	set<int> borderComponents;
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= n;j++){
			if((i == 0 or j == 0) and grid[i][j] != 0){
				borderComponents.insert(grid[i][j]);
			}
		}
	}
	
	internalComponents = ccCounter - 1 - sz(borderComponents);
	string res = writeNumber(internalComponents);
	
	vector<ii> order;
	for(int i = n;i >= 1;i--) order.push_back(ii(i,0));
	for(int j = 0;j <= n;j++) order.push_back(ii(0,j));
	
	vector<int> colors;
	for(ii cell : order) colors.push_back(grid[cell.first][cell.second]);
	
	//showlist(colors);
	
	vector<int> groups;
	
	int b = CNTBUFFER;
	int pre = -1;
	for(int x : colors){
		if(x != 0){
			res[b] = '1';
			
			if(pre != x) groups.push_back(x);
		}
		b++;
		pre = x;
	}
	
	//showlist(groups);
	map<int,vector<int> > grouppos;
	for(int i = 0;i < sz(groups);i++){
		grouppos[groups[i]].push_back(i);
	}
	
	b = GROUPBUFFER;
	for(int i = 0;i < sz(groups);i++){
		int g  = groups[i];
		if(i == grouppos[g][0]) res[b] = '1';
		b++;
		if(i == grouppos[g].back()) res[b] = '1';
		b++;
	}
	
	
	
	
	show(res);
	
	//auto decoded = decode(res);
	
	show(internalComponents);
	//show(decoded.first);
	
	showlist(colors);
	//showlist(decoded.second);
	
	cerr << endl;
	return res;
}

int lastStepConnectivity(int di, int dj, string res){
	vector<ii> order;
	for(int i = n;i >= 1;i--) order.push_back(ii(i+n,n));
	for(int j = 0;j <= n;j++) order.push_back(ii(n,j+n));
	
	//if(di == 0) reverse(all(order));
	
	for(ii &v : order){
		if(di == 0) v.first = 2*n - v.first;
		if(dj == 0) v.second = 2*n - v.second;
	}
	
	auto ddd = decode(res);
	int internalComponents = ddd.first;
	vector<int> colors = ddd.second;
	
	//show2(sz(colors), sz(order));
	show2(di,dj);
	showlist(colors);
	
	map<int, ii> pre;
	for(int i = 0;i < sz(order);i++){
		ii cell = order[i];
		int c = colors[i];
		if(c != 0){
			grid[cell.first][cell.second] = -1;
		
			if(pre.find(c) != pre.end()){
				ii cell2 = pre[c];
				adj[cell].push_back(cell2);
				adj[cell2].push_back(cell);
				
				show2(cell.first, cell.second);
				show2(cell2.first, cell2.second);
			}
			pre[c] = cell;
		}
	}
	
	return internalComponents;
}


 
string process(vector <vector<string>> a, int I, int J, int K, int _n){
	n = _n;
	//cerr << I << " " << J << " " << K << endl;				
	
	/*
	for(int k = 0;k < n;k++){
		for(int i = 0;i <= 2*n - 2*k;i++){
			for(int j = 0;j <= 2*n - 2*k;j++){
				int g = group(i,j,k).first;
				if(g < 10) cerr << " ";
				cerr << g << " ";
			}
			cerr << endl;
		}
		cerr << endl;
	}
	exit(0);
	//*/
	
	
	if(_n == 1){
		resetgrid();
		for(int i = 0;i <= 2;i++){
			for(int j = 0;j <= 2;j++){
				if(a[i][j][0] == '1') grid[i][j] = -1;
			}
		}
		
		int ans = 0;
		for(int i = 0;i <= 2;i++){
			for(int j = 0;j <= 2;j++){
				if(grid[i][j] == -1){
					dfs(i,j);
					ans++;
				}
			}
		}
		
		string res = writeNumber(ans);
		return res;
	}
	
	string res = string(100 ,'0');
	
	if(K == 0){ ///first run
		for(int io = 0;io <= 2;io++){
			for(int jo = 0;jo <= 2;jo++){
				if(a[io][jo][0] == '1'){
					a[io][jo] = string(100, '0');
					a[io][jo][group(io+I,jo+J,0).second] = '1';
				}
				else a[io][jo] = string(100, '0');
			}
		}
	}
	
	if(K == n-1){ ///last phase --> convert to binary 
		resetgrid();
		
		int ans = 0;
		ans += lastStepConnectivity(0,0,a[0][0]);
		ans += lastStepConnectivity(0,2,a[0][2]);
		ans += lastStepConnectivity(2,0,a[2][0]);
		ans += lastStepConnectivity(2,2,a[2][2]);
		
		//*
		for(int i = 0;i <= 2*n;i++){
			for(int j = 0;j <= 2*n;j++){
				cerr << grid[i][j] << " ";
			}
			cerr << endl;
		}
		//*/
		
		int laterComponents = 0;
		for(int i = 0;i <= 2*n;i++){
			for(int j = 0;j <= 2*n;j++){
				if(grid[i][j] == -1){
					dfs(i,j);
					laterComponents++;
				}
			}
		}
		
		show2(ans, laterComponents);
		
		res = writeNumber(ans + laterComponents);
		
		return res;
	}
	
	if(K <= n-2){
		for(int i = 0;i <= 2;i++){
			for(int j = 0;j <= 2;j++){
				if(group(I,J,K+1).first == group(i+I, j+J, K).first){
					orTo(res, a[i][j]);
				} 
			}
		}
	}
	if(K == n-2){
		if(I == 1 or J == 1) return res;
		
		map<ii, ii> GPtoCell;
		for(int i = 0;i <= 2*n;i++){
			for(int j = 0;j <= 2*n;j++){
				GPtoCell[group(i,j,0)] = ii(i,j);
			}
		}

		vector<vector<int> > g;
		
		resetgrid();
		for(int io = 0;io <= 2;io++){
			for(int jo = 0;jo <= 2;jo++){
				int groupno = group(io+I,jo+J,K).first;
				for(int p = 0;p < 100;p++){
					if(a[io][jo][p] == '1'){
						ii cell = GPtoCell[{groupno, p}];
						grid[cell.first][cell.second] = 1;
					}
				}
			}
		}
		
		//*
		for(int i = 0;i <= 2*n;i++){
			for(int j = 0;j <= 2*n;j++){
				cerr << grid[i][j] << " ";
			}
			cerr << endl;
		}
		//*/
		
		int di = (I-1), dj = (J-1);
		
		for(int i = n;i >= 0 and i <= 2*n;i += di){
			g.push_back({});
			for(int j = n;j >= 0 and j <= 2*n;j += dj){
				g.back().push_back(grid[i][j]);
				//cerr << "(" << i << " " << j << ") ";
			}
			//cerr << endl;
		}
		
		res = generateCorner(g);		
	}
	
	//cerr << res << endl;
	
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3976 KB Output is correct
2 Correct 12 ms 4096 KB Output is correct
3 Correct 11 ms 4284 KB Output is correct
4 Correct 13 ms 4284 KB Output is correct
5 Correct 13 ms 3800 KB Output is correct
6 Correct 11 ms 4116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3976 KB Output is correct
2 Correct 12 ms 4096 KB Output is correct
3 Correct 11 ms 4284 KB Output is correct
4 Correct 13 ms 4284 KB Output is correct
5 Correct 13 ms 3800 KB Output is correct
6 Correct 11 ms 4116 KB Output is correct
7 Correct 23 ms 4048 KB Output is correct
8 Correct 36 ms 4472 KB Output is correct
9 Correct 28 ms 4368 KB Output is correct
10 Correct 27 ms 4592 KB Output is correct
11 Correct 34 ms 3980 KB Output is correct
12 Correct 30 ms 4128 KB Output is correct
13 Correct 33 ms 4332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3976 KB Output is correct
2 Correct 12 ms 4096 KB Output is correct
3 Correct 11 ms 4284 KB Output is correct
4 Correct 13 ms 4284 KB Output is correct
5 Correct 13 ms 3800 KB Output is correct
6 Correct 11 ms 4116 KB Output is correct
7 Correct 23 ms 4048 KB Output is correct
8 Correct 36 ms 4472 KB Output is correct
9 Correct 28 ms 4368 KB Output is correct
10 Correct 27 ms 4592 KB Output is correct
11 Correct 34 ms 3980 KB Output is correct
12 Correct 30 ms 4128 KB Output is correct
13 Correct 33 ms 4332 KB Output is correct
14 Correct 51 ms 3764 KB Output is correct
15 Correct 71 ms 4244 KB Output is correct
16 Correct 66 ms 4720 KB Output is correct
17 Correct 75 ms 4340 KB Output is correct
18 Correct 66 ms 4184 KB Output is correct
19 Correct 67 ms 4016 KB Output is correct
20 Correct 66 ms 3980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3976 KB Output is correct
2 Correct 12 ms 4096 KB Output is correct
3 Correct 11 ms 4284 KB Output is correct
4 Correct 13 ms 4284 KB Output is correct
5 Correct 13 ms 3800 KB Output is correct
6 Correct 11 ms 4116 KB Output is correct
7 Correct 23 ms 4048 KB Output is correct
8 Correct 36 ms 4472 KB Output is correct
9 Correct 28 ms 4368 KB Output is correct
10 Correct 27 ms 4592 KB Output is correct
11 Correct 34 ms 3980 KB Output is correct
12 Correct 30 ms 4128 KB Output is correct
13 Correct 33 ms 4332 KB Output is correct
14 Correct 51 ms 3764 KB Output is correct
15 Correct 71 ms 4244 KB Output is correct
16 Correct 66 ms 4720 KB Output is correct
17 Correct 75 ms 4340 KB Output is correct
18 Correct 66 ms 4184 KB Output is correct
19 Correct 67 ms 4016 KB Output is correct
20 Correct 66 ms 3980 KB Output is correct
21 Correct 90 ms 4196 KB Output is correct
22 Correct 134 ms 4368 KB Output is correct
23 Correct 132 ms 3968 KB Output is correct
24 Correct 137 ms 4716 KB Output is correct
25 Correct 135 ms 4084 KB Output is correct
26 Correct 135 ms 4424 KB Output is correct
27 Correct 130 ms 3972 KB Output is correct
28 Correct 131 ms 4616 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3976 KB Output is correct
2 Correct 12 ms 4096 KB Output is correct
3 Correct 11 ms 4284 KB Output is correct
4 Correct 13 ms 4284 KB Output is correct
5 Correct 13 ms 3800 KB Output is correct
6 Correct 11 ms 4116 KB Output is correct
7 Correct 23 ms 4048 KB Output is correct
8 Correct 36 ms 4472 KB Output is correct
9 Correct 28 ms 4368 KB Output is correct
10 Correct 27 ms 4592 KB Output is correct
11 Correct 34 ms 3980 KB Output is correct
12 Correct 30 ms 4128 KB Output is correct
13 Correct 33 ms 4332 KB Output is correct
14 Correct 51 ms 3764 KB Output is correct
15 Correct 71 ms 4244 KB Output is correct
16 Correct 66 ms 4720 KB Output is correct
17 Correct 75 ms 4340 KB Output is correct
18 Correct 66 ms 4184 KB Output is correct
19 Correct 67 ms 4016 KB Output is correct
20 Correct 66 ms 3980 KB Output is correct
21 Correct 90 ms 4196 KB Output is correct
22 Correct 134 ms 4368 KB Output is correct
23 Correct 132 ms 3968 KB Output is correct
24 Correct 137 ms 4716 KB Output is correct
25 Correct 135 ms 4084 KB Output is correct
26 Correct 135 ms 4424 KB Output is correct
27 Correct 130 ms 3972 KB Output is correct
28 Correct 131 ms 4616 KB Output is correct
29 Correct 177 ms 4268 KB Output is correct
30 Correct 239 ms 3952 KB Output is correct
31 Correct 244 ms 4340 KB Output is correct
32 Correct 234 ms 3980 KB Output is correct
33 Correct 239 ms 4124 KB Output is correct
34 Correct 231 ms 4288 KB Output is correct
35 Correct 247 ms 4424 KB Output is correct
36 Correct 240 ms 4584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3976 KB Output is correct
2 Correct 12 ms 4096 KB Output is correct
3 Correct 11 ms 4284 KB Output is correct
4 Correct 13 ms 4284 KB Output is correct
5 Correct 13 ms 3800 KB Output is correct
6 Correct 11 ms 4116 KB Output is correct
7 Correct 23 ms 4048 KB Output is correct
8 Correct 36 ms 4472 KB Output is correct
9 Correct 28 ms 4368 KB Output is correct
10 Correct 27 ms 4592 KB Output is correct
11 Correct 34 ms 3980 KB Output is correct
12 Correct 30 ms 4128 KB Output is correct
13 Correct 33 ms 4332 KB Output is correct
14 Correct 51 ms 3764 KB Output is correct
15 Correct 71 ms 4244 KB Output is correct
16 Correct 66 ms 4720 KB Output is correct
17 Correct 75 ms 4340 KB Output is correct
18 Correct 66 ms 4184 KB Output is correct
19 Correct 67 ms 4016 KB Output is correct
20 Correct 66 ms 3980 KB Output is correct
21 Correct 90 ms 4196 KB Output is correct
22 Correct 134 ms 4368 KB Output is correct
23 Correct 132 ms 3968 KB Output is correct
24 Correct 137 ms 4716 KB Output is correct
25 Correct 135 ms 4084 KB Output is correct
26 Correct 135 ms 4424 KB Output is correct
27 Correct 130 ms 3972 KB Output is correct
28 Correct 131 ms 4616 KB Output is correct
29 Correct 177 ms 4268 KB Output is correct
30 Correct 239 ms 3952 KB Output is correct
31 Correct 244 ms 4340 KB Output is correct
32 Correct 234 ms 3980 KB Output is correct
33 Correct 239 ms 4124 KB Output is correct
34 Correct 231 ms 4288 KB Output is correct
35 Correct 247 ms 4424 KB Output is correct
36 Correct 240 ms 4584 KB Output is correct
37 Correct 305 ms 4264 KB Output is correct
38 Correct 388 ms 4752 KB Output is correct
39 Correct 396 ms 4988 KB Output is correct
40 Correct 394 ms 4960 KB Output is correct
41 Correct 392 ms 4556 KB Output is correct
42 Correct 407 ms 4576 KB Output is correct
43 Correct 397 ms 4928 KB Output is correct
44 Correct 397 ms 4632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3976 KB Output is correct
2 Correct 12 ms 4096 KB Output is correct
3 Correct 11 ms 4284 KB Output is correct
4 Correct 13 ms 4284 KB Output is correct
5 Correct 13 ms 3800 KB Output is correct
6 Correct 11 ms 4116 KB Output is correct
7 Correct 23 ms 4048 KB Output is correct
8 Correct 36 ms 4472 KB Output is correct
9 Correct 28 ms 4368 KB Output is correct
10 Correct 27 ms 4592 KB Output is correct
11 Correct 34 ms 3980 KB Output is correct
12 Correct 30 ms 4128 KB Output is correct
13 Correct 33 ms 4332 KB Output is correct
14 Correct 51 ms 3764 KB Output is correct
15 Correct 71 ms 4244 KB Output is correct
16 Correct 66 ms 4720 KB Output is correct
17 Correct 75 ms 4340 KB Output is correct
18 Correct 66 ms 4184 KB Output is correct
19 Correct 67 ms 4016 KB Output is correct
20 Correct 66 ms 3980 KB Output is correct
21 Correct 90 ms 4196 KB Output is correct
22 Correct 134 ms 4368 KB Output is correct
23 Correct 132 ms 3968 KB Output is correct
24 Correct 137 ms 4716 KB Output is correct
25 Correct 135 ms 4084 KB Output is correct
26 Correct 135 ms 4424 KB Output is correct
27 Correct 130 ms 3972 KB Output is correct
28 Correct 131 ms 4616 KB Output is correct
29 Correct 177 ms 4268 KB Output is correct
30 Correct 239 ms 3952 KB Output is correct
31 Correct 244 ms 4340 KB Output is correct
32 Correct 234 ms 3980 KB Output is correct
33 Correct 239 ms 4124 KB Output is correct
34 Correct 231 ms 4288 KB Output is correct
35 Correct 247 ms 4424 KB Output is correct
36 Correct 240 ms 4584 KB Output is correct
37 Correct 305 ms 4264 KB Output is correct
38 Correct 388 ms 4752 KB Output is correct
39 Correct 396 ms 4988 KB Output is correct
40 Correct 394 ms 4960 KB Output is correct
41 Correct 392 ms 4556 KB Output is correct
42 Correct 407 ms 4576 KB Output is correct
43 Correct 397 ms 4928 KB Output is correct
44 Correct 397 ms 4632 KB Output is correct
45 Correct 513 ms 5800 KB Output is correct
46 Correct 610 ms 4736 KB Output is correct
47 Correct 623 ms 5488 KB Output is correct
48 Correct 617 ms 5308 KB Output is correct
49 Correct 623 ms 5116 KB Output is correct
50 Correct 611 ms 5380 KB Output is correct
51 Correct 635 ms 5552 KB Output is correct
52 Correct 625 ms 5172 KB Output is correct
53 Correct 608 ms 5128 KB Output is correct
54 Correct 621 ms 5284 KB Output is correct
55 Correct 631 ms 4968 KB Output is correct
56 Correct 617 ms 5312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3976 KB Output is correct
2 Correct 12 ms 4096 KB Output is correct
3 Correct 11 ms 4284 KB Output is correct
4 Correct 13 ms 4284 KB Output is correct
5 Correct 13 ms 3800 KB Output is correct
6 Correct 11 ms 4116 KB Output is correct
7 Correct 23 ms 4048 KB Output is correct
8 Correct 36 ms 4472 KB Output is correct
9 Correct 28 ms 4368 KB Output is correct
10 Correct 27 ms 4592 KB Output is correct
11 Correct 34 ms 3980 KB Output is correct
12 Correct 30 ms 4128 KB Output is correct
13 Correct 33 ms 4332 KB Output is correct
14 Correct 51 ms 3764 KB Output is correct
15 Correct 71 ms 4244 KB Output is correct
16 Correct 66 ms 4720 KB Output is correct
17 Correct 75 ms 4340 KB Output is correct
18 Correct 66 ms 4184 KB Output is correct
19 Correct 67 ms 4016 KB Output is correct
20 Correct 66 ms 3980 KB Output is correct
21 Correct 90 ms 4196 KB Output is correct
22 Correct 134 ms 4368 KB Output is correct
23 Correct 132 ms 3968 KB Output is correct
24 Correct 137 ms 4716 KB Output is correct
25 Correct 135 ms 4084 KB Output is correct
26 Correct 135 ms 4424 KB Output is correct
27 Correct 130 ms 3972 KB Output is correct
28 Correct 131 ms 4616 KB Output is correct
29 Correct 177 ms 4268 KB Output is correct
30 Correct 239 ms 3952 KB Output is correct
31 Correct 244 ms 4340 KB Output is correct
32 Correct 234 ms 3980 KB Output is correct
33 Correct 239 ms 4124 KB Output is correct
34 Correct 231 ms 4288 KB Output is correct
35 Correct 247 ms 4424 KB Output is correct
36 Correct 240 ms 4584 KB Output is correct
37 Correct 305 ms 4264 KB Output is correct
38 Correct 388 ms 4752 KB Output is correct
39 Correct 396 ms 4988 KB Output is correct
40 Correct 394 ms 4960 KB Output is correct
41 Correct 392 ms 4556 KB Output is correct
42 Correct 407 ms 4576 KB Output is correct
43 Correct 397 ms 4928 KB Output is correct
44 Correct 397 ms 4632 KB Output is correct
45 Correct 513 ms 5800 KB Output is correct
46 Correct 610 ms 4736 KB Output is correct
47 Correct 623 ms 5488 KB Output is correct
48 Correct 617 ms 5308 KB Output is correct
49 Correct 623 ms 5116 KB Output is correct
50 Correct 611 ms 5380 KB Output is correct
51 Correct 635 ms 5552 KB Output is correct
52 Correct 625 ms 5172 KB Output is correct
53 Correct 608 ms 5128 KB Output is correct
54 Correct 621 ms 5284 KB Output is correct
55 Correct 631 ms 4968 KB Output is correct
56 Correct 617 ms 5312 KB Output is correct
57 Correct 750 ms 5532 KB Output is correct
58 Correct 918 ms 6864 KB Output is correct
59 Correct 932 ms 5216 KB Output is correct
60 Correct 943 ms 6268 KB Output is correct
61 Correct 946 ms 6016 KB Output is correct
62 Correct 916 ms 5356 KB Output is correct
63 Correct 937 ms 5912 KB Output is correct
64 Correct 907 ms 6208 KB Output is correct
65 Correct 928 ms 5952 KB Output is correct
66 Correct 915 ms 5696 KB Output is correct
67 Correct 901 ms 6148 KB Output is correct
68 Correct 907 ms 6232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3976 KB Output is correct
2 Correct 12 ms 4096 KB Output is correct
3 Correct 11 ms 4284 KB Output is correct
4 Correct 13 ms 4284 KB Output is correct
5 Correct 13 ms 3800 KB Output is correct
6 Correct 11 ms 4116 KB Output is correct
7 Correct 23 ms 4048 KB Output is correct
8 Correct 36 ms 4472 KB Output is correct
9 Correct 28 ms 4368 KB Output is correct
10 Correct 27 ms 4592 KB Output is correct
11 Correct 34 ms 3980 KB Output is correct
12 Correct 30 ms 4128 KB Output is correct
13 Correct 33 ms 4332 KB Output is correct
14 Correct 51 ms 3764 KB Output is correct
15 Correct 71 ms 4244 KB Output is correct
16 Correct 66 ms 4720 KB Output is correct
17 Correct 75 ms 4340 KB Output is correct
18 Correct 66 ms 4184 KB Output is correct
19 Correct 67 ms 4016 KB Output is correct
20 Correct 66 ms 3980 KB Output is correct
21 Correct 90 ms 4196 KB Output is correct
22 Correct 134 ms 4368 KB Output is correct
23 Correct 132 ms 3968 KB Output is correct
24 Correct 137 ms 4716 KB Output is correct
25 Correct 135 ms 4084 KB Output is correct
26 Correct 135 ms 4424 KB Output is correct
27 Correct 130 ms 3972 KB Output is correct
28 Correct 131 ms 4616 KB Output is correct
29 Correct 177 ms 4268 KB Output is correct
30 Correct 239 ms 3952 KB Output is correct
31 Correct 244 ms 4340 KB Output is correct
32 Correct 234 ms 3980 KB Output is correct
33 Correct 239 ms 4124 KB Output is correct
34 Correct 231 ms 4288 KB Output is correct
35 Correct 247 ms 4424 KB Output is correct
36 Correct 240 ms 4584 KB Output is correct
37 Correct 305 ms 4264 KB Output is correct
38 Correct 388 ms 4752 KB Output is correct
39 Correct 396 ms 4988 KB Output is correct
40 Correct 394 ms 4960 KB Output is correct
41 Correct 392 ms 4556 KB Output is correct
42 Correct 407 ms 4576 KB Output is correct
43 Correct 397 ms 4928 KB Output is correct
44 Correct 397 ms 4632 KB Output is correct
45 Correct 513 ms 5800 KB Output is correct
46 Correct 610 ms 4736 KB Output is correct
47 Correct 623 ms 5488 KB Output is correct
48 Correct 617 ms 5308 KB Output is correct
49 Correct 623 ms 5116 KB Output is correct
50 Correct 611 ms 5380 KB Output is correct
51 Correct 635 ms 5552 KB Output is correct
52 Correct 625 ms 5172 KB Output is correct
53 Correct 608 ms 5128 KB Output is correct
54 Correct 621 ms 5284 KB Output is correct
55 Correct 631 ms 4968 KB Output is correct
56 Correct 617 ms 5312 KB Output is correct
57 Correct 750 ms 5532 KB Output is correct
58 Correct 918 ms 6864 KB Output is correct
59 Correct 932 ms 5216 KB Output is correct
60 Correct 943 ms 6268 KB Output is correct
61 Correct 946 ms 6016 KB Output is correct
62 Correct 916 ms 5356 KB Output is correct
63 Correct 937 ms 5912 KB Output is correct
64 Correct 907 ms 6208 KB Output is correct
65 Correct 928 ms 5952 KB Output is correct
66 Correct 915 ms 5696 KB Output is correct
67 Correct 901 ms 6148 KB Output is correct
68 Correct 907 ms 6232 KB Output is correct
69 Correct 1117 ms 6500 KB Output is correct
70 Correct 1313 ms 6412 KB Output is correct
71 Correct 1341 ms 6860 KB Output is correct
72 Correct 1323 ms 6136 KB Output is correct
73 Correct 1333 ms 6448 KB Output is correct
74 Correct 1328 ms 6004 KB Output is correct
75 Correct 1323 ms 5960 KB Output is correct
76 Correct 1322 ms 5680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 3976 KB Output is correct
2 Correct 12 ms 4096 KB Output is correct
3 Correct 11 ms 4284 KB Output is correct
4 Correct 13 ms 4284 KB Output is correct
5 Correct 13 ms 3800 KB Output is correct
6 Correct 11 ms 4116 KB Output is correct
7 Correct 23 ms 4048 KB Output is correct
8 Correct 36 ms 4472 KB Output is correct
9 Correct 28 ms 4368 KB Output is correct
10 Correct 27 ms 4592 KB Output is correct
11 Correct 34 ms 3980 KB Output is correct
12 Correct 30 ms 4128 KB Output is correct
13 Correct 33 ms 4332 KB Output is correct
14 Correct 51 ms 3764 KB Output is correct
15 Correct 71 ms 4244 KB Output is correct
16 Correct 66 ms 4720 KB Output is correct
17 Correct 75 ms 4340 KB Output is correct
18 Correct 66 ms 4184 KB Output is correct
19 Correct 67 ms 4016 KB Output is correct
20 Correct 66 ms 3980 KB Output is correct
21 Correct 90 ms 4196 KB Output is correct
22 Correct 134 ms 4368 KB Output is correct
23 Correct 132 ms 3968 KB Output is correct
24 Correct 137 ms 4716 KB Output is correct
25 Correct 135 ms 4084 KB Output is correct
26 Correct 135 ms 4424 KB Output is correct
27 Correct 130 ms 3972 KB Output is correct
28 Correct 131 ms 4616 KB Output is correct
29 Correct 177 ms 4268 KB Output is correct
30 Correct 239 ms 3952 KB Output is correct
31 Correct 244 ms 4340 KB Output is correct
32 Correct 234 ms 3980 KB Output is correct
33 Correct 239 ms 4124 KB Output is correct
34 Correct 231 ms 4288 KB Output is correct
35 Correct 247 ms 4424 KB Output is correct
36 Correct 240 ms 4584 KB Output is correct
37 Correct 305 ms 4264 KB Output is correct
38 Correct 388 ms 4752 KB Output is correct
39 Correct 396 ms 4988 KB Output is correct
40 Correct 394 ms 4960 KB Output is correct
41 Correct 392 ms 4556 KB Output is correct
42 Correct 407 ms 4576 KB Output is correct
43 Correct 397 ms 4928 KB Output is correct
44 Correct 397 ms 4632 KB Output is correct
45 Correct 513 ms 5800 KB Output is correct
46 Correct 610 ms 4736 KB Output is correct
47 Correct 623 ms 5488 KB Output is correct
48 Correct 617 ms 5308 KB Output is correct
49 Correct 623 ms 5116 KB Output is correct
50 Correct 611 ms 5380 KB Output is correct
51 Correct 635 ms 5552 KB Output is correct
52 Correct 625 ms 5172 KB Output is correct
53 Correct 608 ms 5128 KB Output is correct
54 Correct 621 ms 5284 KB Output is correct
55 Correct 631 ms 4968 KB Output is correct
56 Correct 617 ms 5312 KB Output is correct
57 Correct 750 ms 5532 KB Output is correct
58 Correct 918 ms 6864 KB Output is correct
59 Correct 932 ms 5216 KB Output is correct
60 Correct 943 ms 6268 KB Output is correct
61 Correct 946 ms 6016 KB Output is correct
62 Correct 916 ms 5356 KB Output is correct
63 Correct 937 ms 5912 KB Output is correct
64 Correct 907 ms 6208 KB Output is correct
65 Correct 928 ms 5952 KB Output is correct
66 Correct 915 ms 5696 KB Output is correct
67 Correct 901 ms 6148 KB Output is correct
68 Correct 907 ms 6232 KB Output is correct
69 Correct 1117 ms 6500 KB Output is correct
70 Correct 1313 ms 6412 KB Output is correct
71 Correct 1341 ms 6860 KB Output is correct
72 Correct 1323 ms 6136 KB Output is correct
73 Correct 1333 ms 6448 KB Output is correct
74 Correct 1328 ms 6004 KB Output is correct
75 Correct 1323 ms 5960 KB Output is correct
76 Correct 1322 ms 5680 KB Output is correct
77 Correct 1332 ms 7656 KB Output is correct
78 Correct 1834 ms 7524 KB Output is correct
79 Correct 1891 ms 7144 KB Output is correct
80 Correct 1860 ms 7100 KB Output is correct
81 Correct 1853 ms 7320 KB Output is correct
82 Correct 1855 ms 7236 KB Output is correct
83 Correct 1883 ms 7100 KB Output is correct
84 Correct 1835 ms 7768 KB Output is correct