Submission #974978

# Submission time Handle Problem Language Result Execution time Memory
974978 2024-05-04T08:52:01 Z oolimry Mars (APIO22_mars) C++17
36 / 100
147 ms 5296 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;
 
/// attempt 3 store number of connected components?
/// push the values up to the LHS 3x3 square and then process the border information
 
int grid[45][45];
int ccNumber[45][45];
map<ii, vector<ii> > adj;
int CNTBUFFER = 14; ///bits used just to store the size
int ccCounter = 0;
void resetgrid(){
	ccCounter = 1;
	adj.clear();
	for(int i = 0;i < 45;i++) for(int j = 0;j < 45;j++) grid[i][j] = 0;
	for(int i = 0;i < 45;i++) for(int j = 0;j < 45;j++) ccNumber[i][j] = 0;
}
 
void dfs(int i, int j){
	if(i < 0 or j < 0) return;
	if(grid[i][j] == 0) return;
	
	grid[i][j] = 0;
	ccNumber[i][j] = ccCounter;
	
	for(ii cell : adj[ii(i,j)]) dfs(cell.first,cell.second);
	dfs(i+1,j);
	dfs(i-1,j);
	dfs(i,j+1);
	dfs(i,j-1);
} 
 
///return the layer, and the position in that layer
ii layer(int i, int j){
	int L = max(i,j);
	int pos = abs(i - L) + abs(j - 0);
	return {L,pos};
}
 
vector<ii> cellsOnLayer(int L){
	vector<ii> cells;
	for(int j = 0;j <= L;j++) cells.push_back({L,j});
	for(int i = L-1;i >= 0;i--) cells.push_back({i,L});
	return cells;
}
 
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;
}
 
void orTo(string &a, string b){
	for(int p = 0;p < 100;p++){
		if(b[p] == '1') a[p] = '1';
	}
}
 
struct cornerInfo{
	int internalComponents = 0;
	vector<int> border = {};
};
 
string cornerInfoToString(cornerInfo C){
	string res = writeNumber(C.internalComponents);
	
	int b = CNTBUFFER;
	vector<int> S;
	set<int> instack;
	for(int x : C.border){
		
		if(x == 0){ ///0 = zero
			res[b] = '0';
			res[b+1] = '0';
			b += 2;
		}
		else if(instack.find(x) == instack.end()){ ///01 = push
			//show2("01", x);
			res[b] = '0';
			res[b+1] = '1';
			b += 2;
			
			S.push_back(x);
			instack.insert(x);
		}
		else{
			//show2("DOES THIS TRIGGER", x);
			while(S.back() != x){ ///10 = popback				
				res[b] = '1';
				res[b+1] = '0';
				b += 2;
				
				instack.erase(S.back());
				S.pop_back();
			}
			res[b] = '1';
			res[b+1] = '1';
			b += 2;
		}
	}
	
	//show(res);
	
	return res;
}
 
cornerInfo stringToCornerInfo(string s, int szOfBorder){
	cornerInfo C;
	
	for(int b = CNTBUFFER-1;b >= 0;b--){
		C.internalComponents *= 2;
		if(s[b] == '1') C.internalComponents++;
	}
	
	int b = CNTBUFFER;
	vector<int> S;
	int cc = 1;
	
	while(sz(C.border) < szOfBorder){	
		//showlist(S);
		string command = "00";
		command[0] = s[b];
		command[1] = s[b+1];
		
		//show(command);
		
		if(command == "00") C.border.push_back(0);
		if(command == "01"){
			C.border.push_back(cc);
			S.push_back(cc);
			cc++;
		}
		if(command == "10") S.pop_back();
		if(command == "11"){
			C.border.push_back(S.back());
		}
		
		b += 2;
	}
	
	return C;
}
 
 
string process(vector <vector<string>> a, int I, int J, int K, int n){
	string res = string(100,'0');
	
	/* testing cornerInfo conversion
	cornerInfo C; C.internalComponents = 4; C.border = {1,0,3,0,4};
	string S = cornerInfoToString(C); show(S);
	C = stringToCornerInfo(S, 5); show(C.internalComponents); showlist(C.border);
	return res;
	*/
	
	//cerr << I << " " << J << " " << K << endl;
	
	if(K == 0){ ///first run
		for(int i = 0;i <= 2;i++){
			for(int j = 0;j <= 2;j++){
				if(a[i][j][0] == '1'){
					a[i][j] = string(100, '0');
					ii info = layer(I+i, j+J);
					
					a[i][j][info.second] = '1';
				}
				else a[i][j] = string(100, '0');
			}
		}
		
		if(I == 0 and J == 0){		
			cornerInfo C; C.internalComponents = 0;
			if(a[0][0][0] == '1') C.border = {1};
			else C.border = {0};
			
			a[0][0] = cornerInfoToString(C);
		}
	}
	
	if(I == 0 and J == 0){ /// do the terrible graph thing
		resetgrid();
		
		int layer0 = K*2;
		int layer1 = layer0 + 1;
		int layer2 = layer1 + 1;
		
		auto layer0cells = cellsOnLayer(layer0);
		auto layer1cells = cellsOnLayer(layer1);
		auto layer2cells = cellsOnLayer(layer2);
		
		show(a[0][0]);
		cornerInfo C = stringToCornerInfo(a[0][0], sz(layer0cells));
		showlist(C.border);
		
		string layer1String = string(100, '0');
		string layer2String = string(100, '0');
		
		for(int i = 0;i <= 2;i++){
			for(int j = 0;j <= 2;j++){
				if(i == 0 and j == 0) continue;
				
				if(i == 2 or j == 2) orTo(layer2String, a[i][j]);
				else orTo(layer1String, a[i][j]);
			}
		}
		
		map<int, ii> prevSameComponent;
		for(int a = 0;a < sz(layer0cells);a++){
			ii cell = layer0cells[a];
			int cc = C.border[a];
			if(cc != 0) grid[cell.first][cell.second] = 1;
			
			if(cc != 0 and prevSameComponent.find(cc) != prevSameComponent.end()){
				ii cell2 = prevSameComponent[cc];
				adj[cell].push_back(cell2);
				adj[cell2].push_back(cell);
			}
			prevSameComponent[cc] = cell;
		}
		
		for(int a = 0;a < sz(layer1cells);a++){
			ii cell = layer1cells[a];
			if(layer1String[a] == '1') grid[cell.first][cell.second] = 1;
			else grid[cell.first][cell.second] = 0;
		}
		for(int a = 0;a < sz(layer2cells);a++){
			ii cell = layer2cells[a];
			if(layer2String[a] == '1') grid[cell.first][cell.second] = 1;
			else grid[cell.first][cell.second] = 0;
		}
		
		for(int i = 0;i <= 2*n;i++){
			for(int j = 0;j <= 2*n;j++){
				//cerr << grid[i][j] << " ";
			}
			//cerr << endl;
		}
		
		for(int i = 0;i <= 2*n;i++) for(int j = 0;j <= 2*n;j++){
			if(grid[i][j] != 0){
				dfs(i,j);
				ccCounter++;
			}
		}
		
		set<int> borderComponents;
		for(ii cell : layer2cells){
			int cc = ccNumber[cell.first][cell.second];
			if(cc != 0) borderComponents.insert(cc);
		}
		
		C.internalComponents += ccCounter - sz(borderComponents) - 1;
		
		/* bad
		for(int i = 0;i <= 2*n;i++) for(int j = 0;j <= 2*n;j++){
			int cc = ccNumber[i][j];
			if(cc != 0 and borderComponents.find(cc) == borderComponents.end()){
				C.internalComponents++;
			}
		}
		*/
		
		map<int,int> disc;
		int discCnt = 1;
		for(int x : borderComponents) disc[x] = discCnt++;
		
		C.border.clear();
		for(ii cell : layer2cells){
			int cc = ccNumber[cell.first][cell.second];
			if(cc == 0) C.border.push_back(0);
			else C.border.push_back(disc[cc]);
		}
		
		//
		
		show(C.internalComponents);
		showlist(C.border);
		
		if(K == n-1){ ///final run
			int ans = C.internalComponents + sz(borderComponents);
			res = writeNumber(ans);
		}	
		else{
			///finally write the cell info
			res = cornerInfoToString(C);
		}
	}
	else{
		for(int i = 0;i <= 2;i++){
			for(int j = 0;j <= 2;j++){
				if(layer(I,J).first == layer(i+I,j+J).first - 2) orTo(res, a[i][j]);
			}
		}
	}
	
	
	
	// cerr << res << endl;
	
	
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4036 KB Output is correct
2 Correct 8 ms 4212 KB Output is correct
3 Correct 7 ms 4032 KB Output is correct
4 Correct 8 ms 3860 KB Output is correct
5 Correct 7 ms 3516 KB Output is correct
6 Correct 8 ms 4120 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4036 KB Output is correct
2 Correct 8 ms 4212 KB Output is correct
3 Correct 7 ms 4032 KB Output is correct
4 Correct 8 ms 3860 KB Output is correct
5 Correct 7 ms 3516 KB Output is correct
6 Correct 8 ms 4120 KB Output is correct
7 Correct 11 ms 3992 KB Output is correct
8 Correct 16 ms 4096 KB Output is correct
9 Correct 9 ms 3752 KB Output is correct
10 Correct 14 ms 3968 KB Output is correct
11 Correct 14 ms 4144 KB Output is correct
12 Correct 13 ms 3844 KB Output is correct
13 Correct 13 ms 4024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4036 KB Output is correct
2 Correct 8 ms 4212 KB Output is correct
3 Correct 7 ms 4032 KB Output is correct
4 Correct 8 ms 3860 KB Output is correct
5 Correct 7 ms 3516 KB Output is correct
6 Correct 8 ms 4120 KB Output is correct
7 Correct 11 ms 3992 KB Output is correct
8 Correct 16 ms 4096 KB Output is correct
9 Correct 9 ms 3752 KB Output is correct
10 Correct 14 ms 3968 KB Output is correct
11 Correct 14 ms 4144 KB Output is correct
12 Correct 13 ms 3844 KB Output is correct
13 Correct 13 ms 4024 KB Output is correct
14 Correct 20 ms 4488 KB Output is correct
15 Correct 30 ms 4532 KB Output is correct
16 Correct 32 ms 4464 KB Output is correct
17 Correct 30 ms 4448 KB Output is correct
18 Correct 30 ms 3868 KB Output is correct
19 Correct 29 ms 4500 KB Output is correct
20 Correct 32 ms 4460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4036 KB Output is correct
2 Correct 8 ms 4212 KB Output is correct
3 Correct 7 ms 4032 KB Output is correct
4 Correct 8 ms 3860 KB Output is correct
5 Correct 7 ms 3516 KB Output is correct
6 Correct 8 ms 4120 KB Output is correct
7 Correct 11 ms 3992 KB Output is correct
8 Correct 16 ms 4096 KB Output is correct
9 Correct 9 ms 3752 KB Output is correct
10 Correct 14 ms 3968 KB Output is correct
11 Correct 14 ms 4144 KB Output is correct
12 Correct 13 ms 3844 KB Output is correct
13 Correct 13 ms 4024 KB Output is correct
14 Correct 20 ms 4488 KB Output is correct
15 Correct 30 ms 4532 KB Output is correct
16 Correct 32 ms 4464 KB Output is correct
17 Correct 30 ms 4448 KB Output is correct
18 Correct 30 ms 3868 KB Output is correct
19 Correct 29 ms 4500 KB Output is correct
20 Correct 32 ms 4460 KB Output is correct
21 Correct 44 ms 4284 KB Output is correct
22 Correct 62 ms 4052 KB Output is correct
23 Correct 60 ms 5296 KB Output is correct
24 Correct 64 ms 4536 KB Output is correct
25 Correct 62 ms 4892 KB Output is correct
26 Correct 63 ms 4448 KB Output is correct
27 Correct 63 ms 4092 KB Output is correct
28 Correct 64 ms 4484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4036 KB Output is correct
2 Correct 8 ms 4212 KB Output is correct
3 Correct 7 ms 4032 KB Output is correct
4 Correct 8 ms 3860 KB Output is correct
5 Correct 7 ms 3516 KB Output is correct
6 Correct 8 ms 4120 KB Output is correct
7 Correct 11 ms 3992 KB Output is correct
8 Correct 16 ms 4096 KB Output is correct
9 Correct 9 ms 3752 KB Output is correct
10 Correct 14 ms 3968 KB Output is correct
11 Correct 14 ms 4144 KB Output is correct
12 Correct 13 ms 3844 KB Output is correct
13 Correct 13 ms 4024 KB Output is correct
14 Correct 20 ms 4488 KB Output is correct
15 Correct 30 ms 4532 KB Output is correct
16 Correct 32 ms 4464 KB Output is correct
17 Correct 30 ms 4448 KB Output is correct
18 Correct 30 ms 3868 KB Output is correct
19 Correct 29 ms 4500 KB Output is correct
20 Correct 32 ms 4460 KB Output is correct
21 Correct 44 ms 4284 KB Output is correct
22 Correct 62 ms 4052 KB Output is correct
23 Correct 60 ms 5296 KB Output is correct
24 Correct 64 ms 4536 KB Output is correct
25 Correct 62 ms 4892 KB Output is correct
26 Correct 63 ms 4448 KB Output is correct
27 Correct 63 ms 4092 KB Output is correct
28 Correct 64 ms 4484 KB Output is correct
29 Correct 84 ms 4212 KB Output is correct
30 Correct 112 ms 4492 KB Output is correct
31 Correct 112 ms 4936 KB Output is correct
32 Correct 114 ms 4140 KB Output is correct
33 Correct 119 ms 4388 KB Output is correct
34 Correct 114 ms 4184 KB Output is correct
35 Correct 114 ms 4608 KB Output is correct
36 Correct 114 ms 4904 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4036 KB Output is correct
2 Correct 8 ms 4212 KB Output is correct
3 Correct 7 ms 4032 KB Output is correct
4 Correct 8 ms 3860 KB Output is correct
5 Correct 7 ms 3516 KB Output is correct
6 Correct 8 ms 4120 KB Output is correct
7 Correct 11 ms 3992 KB Output is correct
8 Correct 16 ms 4096 KB Output is correct
9 Correct 9 ms 3752 KB Output is correct
10 Correct 14 ms 3968 KB Output is correct
11 Correct 14 ms 4144 KB Output is correct
12 Correct 13 ms 3844 KB Output is correct
13 Correct 13 ms 4024 KB Output is correct
14 Correct 20 ms 4488 KB Output is correct
15 Correct 30 ms 4532 KB Output is correct
16 Correct 32 ms 4464 KB Output is correct
17 Correct 30 ms 4448 KB Output is correct
18 Correct 30 ms 3868 KB Output is correct
19 Correct 29 ms 4500 KB Output is correct
20 Correct 32 ms 4460 KB Output is correct
21 Correct 44 ms 4284 KB Output is correct
22 Correct 62 ms 4052 KB Output is correct
23 Correct 60 ms 5296 KB Output is correct
24 Correct 64 ms 4536 KB Output is correct
25 Correct 62 ms 4892 KB Output is correct
26 Correct 63 ms 4448 KB Output is correct
27 Correct 63 ms 4092 KB Output is correct
28 Correct 64 ms 4484 KB Output is correct
29 Correct 84 ms 4212 KB Output is correct
30 Correct 112 ms 4492 KB Output is correct
31 Correct 112 ms 4936 KB Output is correct
32 Correct 114 ms 4140 KB Output is correct
33 Correct 119 ms 4388 KB Output is correct
34 Correct 114 ms 4184 KB Output is correct
35 Correct 114 ms 4608 KB Output is correct
36 Correct 114 ms 4904 KB Output is correct
37 Correct 147 ms 4644 KB Output is correct
38 Incorrect 24 ms 588 KB Incorrect
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4036 KB Output is correct
2 Correct 8 ms 4212 KB Output is correct
3 Correct 7 ms 4032 KB Output is correct
4 Correct 8 ms 3860 KB Output is correct
5 Correct 7 ms 3516 KB Output is correct
6 Correct 8 ms 4120 KB Output is correct
7 Correct 11 ms 3992 KB Output is correct
8 Correct 16 ms 4096 KB Output is correct
9 Correct 9 ms 3752 KB Output is correct
10 Correct 14 ms 3968 KB Output is correct
11 Correct 14 ms 4144 KB Output is correct
12 Correct 13 ms 3844 KB Output is correct
13 Correct 13 ms 4024 KB Output is correct
14 Correct 20 ms 4488 KB Output is correct
15 Correct 30 ms 4532 KB Output is correct
16 Correct 32 ms 4464 KB Output is correct
17 Correct 30 ms 4448 KB Output is correct
18 Correct 30 ms 3868 KB Output is correct
19 Correct 29 ms 4500 KB Output is correct
20 Correct 32 ms 4460 KB Output is correct
21 Correct 44 ms 4284 KB Output is correct
22 Correct 62 ms 4052 KB Output is correct
23 Correct 60 ms 5296 KB Output is correct
24 Correct 64 ms 4536 KB Output is correct
25 Correct 62 ms 4892 KB Output is correct
26 Correct 63 ms 4448 KB Output is correct
27 Correct 63 ms 4092 KB Output is correct
28 Correct 64 ms 4484 KB Output is correct
29 Correct 84 ms 4212 KB Output is correct
30 Correct 112 ms 4492 KB Output is correct
31 Correct 112 ms 4936 KB Output is correct
32 Correct 114 ms 4140 KB Output is correct
33 Correct 119 ms 4388 KB Output is correct
34 Correct 114 ms 4184 KB Output is correct
35 Correct 114 ms 4608 KB Output is correct
36 Correct 114 ms 4904 KB Output is correct
37 Correct 147 ms 4644 KB Output is correct
38 Incorrect 24 ms 588 KB Incorrect
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4036 KB Output is correct
2 Correct 8 ms 4212 KB Output is correct
3 Correct 7 ms 4032 KB Output is correct
4 Correct 8 ms 3860 KB Output is correct
5 Correct 7 ms 3516 KB Output is correct
6 Correct 8 ms 4120 KB Output is correct
7 Correct 11 ms 3992 KB Output is correct
8 Correct 16 ms 4096 KB Output is correct
9 Correct 9 ms 3752 KB Output is correct
10 Correct 14 ms 3968 KB Output is correct
11 Correct 14 ms 4144 KB Output is correct
12 Correct 13 ms 3844 KB Output is correct
13 Correct 13 ms 4024 KB Output is correct
14 Correct 20 ms 4488 KB Output is correct
15 Correct 30 ms 4532 KB Output is correct
16 Correct 32 ms 4464 KB Output is correct
17 Correct 30 ms 4448 KB Output is correct
18 Correct 30 ms 3868 KB Output is correct
19 Correct 29 ms 4500 KB Output is correct
20 Correct 32 ms 4460 KB Output is correct
21 Correct 44 ms 4284 KB Output is correct
22 Correct 62 ms 4052 KB Output is correct
23 Correct 60 ms 5296 KB Output is correct
24 Correct 64 ms 4536 KB Output is correct
25 Correct 62 ms 4892 KB Output is correct
26 Correct 63 ms 4448 KB Output is correct
27 Correct 63 ms 4092 KB Output is correct
28 Correct 64 ms 4484 KB Output is correct
29 Correct 84 ms 4212 KB Output is correct
30 Correct 112 ms 4492 KB Output is correct
31 Correct 112 ms 4936 KB Output is correct
32 Correct 114 ms 4140 KB Output is correct
33 Correct 119 ms 4388 KB Output is correct
34 Correct 114 ms 4184 KB Output is correct
35 Correct 114 ms 4608 KB Output is correct
36 Correct 114 ms 4904 KB Output is correct
37 Correct 147 ms 4644 KB Output is correct
38 Incorrect 24 ms 588 KB Incorrect
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4036 KB Output is correct
2 Correct 8 ms 4212 KB Output is correct
3 Correct 7 ms 4032 KB Output is correct
4 Correct 8 ms 3860 KB Output is correct
5 Correct 7 ms 3516 KB Output is correct
6 Correct 8 ms 4120 KB Output is correct
7 Correct 11 ms 3992 KB Output is correct
8 Correct 16 ms 4096 KB Output is correct
9 Correct 9 ms 3752 KB Output is correct
10 Correct 14 ms 3968 KB Output is correct
11 Correct 14 ms 4144 KB Output is correct
12 Correct 13 ms 3844 KB Output is correct
13 Correct 13 ms 4024 KB Output is correct
14 Correct 20 ms 4488 KB Output is correct
15 Correct 30 ms 4532 KB Output is correct
16 Correct 32 ms 4464 KB Output is correct
17 Correct 30 ms 4448 KB Output is correct
18 Correct 30 ms 3868 KB Output is correct
19 Correct 29 ms 4500 KB Output is correct
20 Correct 32 ms 4460 KB Output is correct
21 Correct 44 ms 4284 KB Output is correct
22 Correct 62 ms 4052 KB Output is correct
23 Correct 60 ms 5296 KB Output is correct
24 Correct 64 ms 4536 KB Output is correct
25 Correct 62 ms 4892 KB Output is correct
26 Correct 63 ms 4448 KB Output is correct
27 Correct 63 ms 4092 KB Output is correct
28 Correct 64 ms 4484 KB Output is correct
29 Correct 84 ms 4212 KB Output is correct
30 Correct 112 ms 4492 KB Output is correct
31 Correct 112 ms 4936 KB Output is correct
32 Correct 114 ms 4140 KB Output is correct
33 Correct 119 ms 4388 KB Output is correct
34 Correct 114 ms 4184 KB Output is correct
35 Correct 114 ms 4608 KB Output is correct
36 Correct 114 ms 4904 KB Output is correct
37 Correct 147 ms 4644 KB Output is correct
38 Incorrect 24 ms 588 KB Incorrect
39 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 4036 KB Output is correct
2 Correct 8 ms 4212 KB Output is correct
3 Correct 7 ms 4032 KB Output is correct
4 Correct 8 ms 3860 KB Output is correct
5 Correct 7 ms 3516 KB Output is correct
6 Correct 8 ms 4120 KB Output is correct
7 Correct 11 ms 3992 KB Output is correct
8 Correct 16 ms 4096 KB Output is correct
9 Correct 9 ms 3752 KB Output is correct
10 Correct 14 ms 3968 KB Output is correct
11 Correct 14 ms 4144 KB Output is correct
12 Correct 13 ms 3844 KB Output is correct
13 Correct 13 ms 4024 KB Output is correct
14 Correct 20 ms 4488 KB Output is correct
15 Correct 30 ms 4532 KB Output is correct
16 Correct 32 ms 4464 KB Output is correct
17 Correct 30 ms 4448 KB Output is correct
18 Correct 30 ms 3868 KB Output is correct
19 Correct 29 ms 4500 KB Output is correct
20 Correct 32 ms 4460 KB Output is correct
21 Correct 44 ms 4284 KB Output is correct
22 Correct 62 ms 4052 KB Output is correct
23 Correct 60 ms 5296 KB Output is correct
24 Correct 64 ms 4536 KB Output is correct
25 Correct 62 ms 4892 KB Output is correct
26 Correct 63 ms 4448 KB Output is correct
27 Correct 63 ms 4092 KB Output is correct
28 Correct 64 ms 4484 KB Output is correct
29 Correct 84 ms 4212 KB Output is correct
30 Correct 112 ms 4492 KB Output is correct
31 Correct 112 ms 4936 KB Output is correct
32 Correct 114 ms 4140 KB Output is correct
33 Correct 119 ms 4388 KB Output is correct
34 Correct 114 ms 4184 KB Output is correct
35 Correct 114 ms 4608 KB Output is correct
36 Correct 114 ms 4904 KB Output is correct
37 Correct 147 ms 4644 KB Output is correct
38 Incorrect 24 ms 588 KB Incorrect
39 Halted 0 ms 0 KB -