Submission #572777

# Submission time Handle Problem Language Result Execution time Memory
572777 2022-06-05T09:16:39 Z benson1029 Mars (APIO22_mars) C++17
100 / 100
1310 ms 8432 KB
#include "mars.h"
#include<bits/stdc++.h>
using namespace std;

int N;
int v[100][100];
int refId[100][100];
vector< pair<int,int> > refs[10000];
int newGrpId[100][100];
int grpId;
bool vis[100][100];
int freq[10000];
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};

bool valid(int x, int y) {
	return ((x>=0 && y>=0 && x<=2*N && y<=2*N) && (v[x][y] == 1 && !vis[x][y]));
}

void dfs(int x, int y) {
	newGrpId[x][y] = grpId;
	vis[x][y] = true;
	for(int i=0; i<4; i++) {
		if(valid(x+dx[i], y+dy[i])) {
			dfs(x+dx[i], y+dy[i]);
		}
	}
	if(refId[x][y]!=-1) {
		for(auto i:refs[refId[x][y]]) {
			if(valid(i.first, i.second)) dfs(i.first, i.second);
		}
	}
}

string inttobin(int v, int len) {
	string rv = "";
	for(int i=0; i<len; i++) {
		if((v>>i)%2) rv += "1";
		else rv += "0";
	}
	return rv;
}

std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n)
{
	N = n;
	// case handling
	int m = 2*(n-k-1);
	if(i == m && j == m) {
		
		// find v
		for(int I=0; I<=2*n; I++) {
			for(int J=0; J<=2*n; J++) {
				v[I][J] = -1;
				refId[I][J] = -1;
				vis[I][J] = false;
			}
		}
		string d1 = a[1][0].substr(1, k*3);
		string d2 = a[2][0].substr(1, k*3);
		string r1 = a[0][1].substr(1, k*3);
		string r2 = a[0][2].substr(1, k*3);
		int ptr = 0;
		for(int I=i+3; I<=2*n; I+=2) {
			for(int J=j; J<=j+2; J++) {
				v[I][J] = d1[ptr] - '0';
				ptr++;
			}
		}
		ptr = 0;
		for(int I=i+4; I<=2*n; I+=2) {
			for(int J=j; J<=j+2; J++) {
				v[I][J] = d2[ptr] - '0';
				ptr++;
			}
		}
		ptr = 0;
		for(int J=j+3; J<=2*n; J+=2) {
			for(int I=i; I<=i+2; I++) {
				v[I][J] = r1[ptr] - '0';
				ptr++;
			}
		}
		ptr = 0;
		for(int J=j+4; J<=2*n; J+=2) {
			for(int I=i; I<=i+2; I++) {
				v[I][J] = r2[ptr] - '0';
				ptr++;
			}
		}
		for(int I=i; I<=i+2; I++) for(int J=j; J<=j+2; J++) v[I][J] = a[I-i][J-j][0] - '0';
		
		// decode previous string
		int ans = 0;
		
		if(k > 0) {
			string ansstr = a[2][2].substr(1, 10);
			for(int I=0; I<10; I++) {
				if(ansstr[I]=='1') ans += (1<<I);
			}
			
			vector< pair<int, int> > L; L.clear();
			vector< pair<int, int> > L2; L2.clear();
			vector<int> rel; rel.clear();
			
			for(int I=2*n; I>=i+2; I--) L.push_back({I, j+2});
			for(int J=j+3; J<=2*n; J++) L.push_back({i+2, J});
			
			int Prev = 0;
			int cnt = 0;
			for(auto c:L) {
				if(Prev == 0 && v[c.first][c.second] == 1) {
					refId[c.first][c.second] = cnt;
					L2.push_back(c);
					cnt++;
				}
				Prev = v[c.first][c.second];
			}
			
			string relstr = a[2][2].substr(11, 1e9); 
			stack<int> stk;
			
			int tmpcnt = -1;
			for(int I=0; I<relstr.length(); I++) {
				if(relstr[I] == '1') {
					if(tmpcnt+1 == cnt) break;
					tmpcnt++;
					stk.push(tmpcnt);
				} else {
					stk.pop();
					refId[L2[tmpcnt].first][L2[tmpcnt].second] = stk.top();
				}
			}
			
			for(int I=0; I<cnt; I++) refs[I].clear();
			for(auto c:L) {
				if(refId[c.first][c.second] != -1) {
					refs[refId[c.first][c.second]].push_back(c);
				}
			}
			
		}
		
		grpId = 0;
		for(int I=i; I<=2*n; I++) {
			for(int J=j; J<=2*n; J++) {
				if(v[I][J] == 1 && !vis[I][J]) {
					dfs(I, J);
					grpId++;
					ans++;
				}
			}
		}
		
		if(k == n-1) {
			string str = "";
			str += inttobin(ans, 15);
			while(str.length()<100) str+="0";
			return str;
		}
		
		// create string
		vector< pair<int, int> > L; L.clear();
		for(int I=2*n; I>=i; I--) L.push_back({I, j});		
		for(int J=j+1; J<=2*n; J++) L.push_back({i, J});
		
		for(int I=0; I<=grpId; I++) freq[I] = -1;
		
		stack<int> stk;
		string refStr = "";
		
		int Prev = 0;
		int tmpid = 0;
		for(auto c:L) {
			if(Prev == 0 && v[c.first][c.second] == 1) {
				if(freq[newGrpId[c.first][c.second]] == -1) {
					stk.push(tmpid);
					refStr += "1";
					freq[newGrpId[c.first][c.second]] = tmpid;
					ans--;
					tmpid++;
				} else {
					stk.push(tmpid);
					tmpid++;
					refStr += "1";
					while(stk.top() != freq[newGrpId[c.first][c.second]]) {
						stk.pop();
						refStr += "0";
					}
				}
			}
			Prev = v[c.first][c.second];
		}
		
		string str = "";
		str += a[0][0][0];
		str += inttobin(ans, 10);
		str += refStr;
		str += "1";
		while(str.length() < 100) str += "0";
		return str; 
	} else if(i == m || i == m-1) {
		string str = "";
		str += a[0][0][0];
		str += a[2][0][0];
		str += a[2][1][0];
		str += a[2][2][0];
		str += a[2][0].substr(1, k*3);
		while(str.length() < 100) str += "0";
		return str;
	} else if(j == m || j == m-1) {
		string str = "";
		str += a[0][0][0];
		str += a[0][2][0];
		str += a[1][2][0];
		str += a[2][2][0];
		str += a[0][2].substr(1, k*3);
		while(str.length() < 100) str += "0";
		return str;
	}
	return a[0][0][0] + string(99, '0');
}

Compilation message

mars.cpp: In function 'std::string process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:124:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  124 |    for(int I=0; I<relstr.length(); I++) {
      |                 ~^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4036 KB Output is correct
2 Correct 8 ms 4028 KB Output is correct
3 Correct 8 ms 4048 KB Output is correct
4 Correct 8 ms 4120 KB Output is correct
5 Correct 8 ms 3992 KB Output is correct
6 Correct 8 ms 4108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4036 KB Output is correct
2 Correct 8 ms 4028 KB Output is correct
3 Correct 8 ms 4048 KB Output is correct
4 Correct 8 ms 4120 KB Output is correct
5 Correct 8 ms 3992 KB Output is correct
6 Correct 8 ms 4108 KB Output is correct
7 Correct 12 ms 3988 KB Output is correct
8 Correct 16 ms 4416 KB Output is correct
9 Correct 18 ms 4376 KB Output is correct
10 Correct 16 ms 4292 KB Output is correct
11 Correct 16 ms 4464 KB Output is correct
12 Correct 18 ms 4416 KB Output is correct
13 Correct 17 ms 4528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4036 KB Output is correct
2 Correct 8 ms 4028 KB Output is correct
3 Correct 8 ms 4048 KB Output is correct
4 Correct 8 ms 4120 KB Output is correct
5 Correct 8 ms 3992 KB Output is correct
6 Correct 8 ms 4108 KB Output is correct
7 Correct 12 ms 3988 KB Output is correct
8 Correct 16 ms 4416 KB Output is correct
9 Correct 18 ms 4376 KB Output is correct
10 Correct 16 ms 4292 KB Output is correct
11 Correct 16 ms 4464 KB Output is correct
12 Correct 18 ms 4416 KB Output is correct
13 Correct 17 ms 4528 KB Output is correct
14 Correct 28 ms 4552 KB Output is correct
15 Correct 41 ms 4672 KB Output is correct
16 Correct 45 ms 4720 KB Output is correct
17 Correct 40 ms 4704 KB Output is correct
18 Correct 40 ms 4708 KB Output is correct
19 Correct 43 ms 4872 KB Output is correct
20 Correct 40 ms 4816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4036 KB Output is correct
2 Correct 8 ms 4028 KB Output is correct
3 Correct 8 ms 4048 KB Output is correct
4 Correct 8 ms 4120 KB Output is correct
5 Correct 8 ms 3992 KB Output is correct
6 Correct 8 ms 4108 KB Output is correct
7 Correct 12 ms 3988 KB Output is correct
8 Correct 16 ms 4416 KB Output is correct
9 Correct 18 ms 4376 KB Output is correct
10 Correct 16 ms 4292 KB Output is correct
11 Correct 16 ms 4464 KB Output is correct
12 Correct 18 ms 4416 KB Output is correct
13 Correct 17 ms 4528 KB Output is correct
14 Correct 28 ms 4552 KB Output is correct
15 Correct 41 ms 4672 KB Output is correct
16 Correct 45 ms 4720 KB Output is correct
17 Correct 40 ms 4704 KB Output is correct
18 Correct 40 ms 4708 KB Output is correct
19 Correct 43 ms 4872 KB Output is correct
20 Correct 40 ms 4816 KB Output is correct
21 Correct 61 ms 4856 KB Output is correct
22 Correct 95 ms 5260 KB Output is correct
23 Correct 84 ms 5092 KB Output is correct
24 Correct 86 ms 5104 KB Output is correct
25 Correct 90 ms 5112 KB Output is correct
26 Correct 87 ms 5136 KB Output is correct
27 Correct 89 ms 5180 KB Output is correct
28 Correct 85 ms 5192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4036 KB Output is correct
2 Correct 8 ms 4028 KB Output is correct
3 Correct 8 ms 4048 KB Output is correct
4 Correct 8 ms 4120 KB Output is correct
5 Correct 8 ms 3992 KB Output is correct
6 Correct 8 ms 4108 KB Output is correct
7 Correct 12 ms 3988 KB Output is correct
8 Correct 16 ms 4416 KB Output is correct
9 Correct 18 ms 4376 KB Output is correct
10 Correct 16 ms 4292 KB Output is correct
11 Correct 16 ms 4464 KB Output is correct
12 Correct 18 ms 4416 KB Output is correct
13 Correct 17 ms 4528 KB Output is correct
14 Correct 28 ms 4552 KB Output is correct
15 Correct 41 ms 4672 KB Output is correct
16 Correct 45 ms 4720 KB Output is correct
17 Correct 40 ms 4704 KB Output is correct
18 Correct 40 ms 4708 KB Output is correct
19 Correct 43 ms 4872 KB Output is correct
20 Correct 40 ms 4816 KB Output is correct
21 Correct 61 ms 4856 KB Output is correct
22 Correct 95 ms 5260 KB Output is correct
23 Correct 84 ms 5092 KB Output is correct
24 Correct 86 ms 5104 KB Output is correct
25 Correct 90 ms 5112 KB Output is correct
26 Correct 87 ms 5136 KB Output is correct
27 Correct 89 ms 5180 KB Output is correct
28 Correct 85 ms 5192 KB Output is correct
29 Correct 127 ms 5188 KB Output is correct
30 Correct 157 ms 5376 KB Output is correct
31 Correct 168 ms 5336 KB Output is correct
32 Correct 163 ms 5396 KB Output is correct
33 Correct 165 ms 5400 KB Output is correct
34 Correct 161 ms 5384 KB Output is correct
35 Correct 171 ms 5384 KB Output is correct
36 Correct 165 ms 5364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4036 KB Output is correct
2 Correct 8 ms 4028 KB Output is correct
3 Correct 8 ms 4048 KB Output is correct
4 Correct 8 ms 4120 KB Output is correct
5 Correct 8 ms 3992 KB Output is correct
6 Correct 8 ms 4108 KB Output is correct
7 Correct 12 ms 3988 KB Output is correct
8 Correct 16 ms 4416 KB Output is correct
9 Correct 18 ms 4376 KB Output is correct
10 Correct 16 ms 4292 KB Output is correct
11 Correct 16 ms 4464 KB Output is correct
12 Correct 18 ms 4416 KB Output is correct
13 Correct 17 ms 4528 KB Output is correct
14 Correct 28 ms 4552 KB Output is correct
15 Correct 41 ms 4672 KB Output is correct
16 Correct 45 ms 4720 KB Output is correct
17 Correct 40 ms 4704 KB Output is correct
18 Correct 40 ms 4708 KB Output is correct
19 Correct 43 ms 4872 KB Output is correct
20 Correct 40 ms 4816 KB Output is correct
21 Correct 61 ms 4856 KB Output is correct
22 Correct 95 ms 5260 KB Output is correct
23 Correct 84 ms 5092 KB Output is correct
24 Correct 86 ms 5104 KB Output is correct
25 Correct 90 ms 5112 KB Output is correct
26 Correct 87 ms 5136 KB Output is correct
27 Correct 89 ms 5180 KB Output is correct
28 Correct 85 ms 5192 KB Output is correct
29 Correct 127 ms 5188 KB Output is correct
30 Correct 157 ms 5376 KB Output is correct
31 Correct 168 ms 5336 KB Output is correct
32 Correct 163 ms 5396 KB Output is correct
33 Correct 165 ms 5400 KB Output is correct
34 Correct 161 ms 5384 KB Output is correct
35 Correct 171 ms 5384 KB Output is correct
36 Correct 165 ms 5364 KB Output is correct
37 Correct 222 ms 5768 KB Output is correct
38 Correct 278 ms 6000 KB Output is correct
39 Correct 280 ms 6124 KB Output is correct
40 Correct 283 ms 5952 KB Output is correct
41 Correct 279 ms 6060 KB Output is correct
42 Correct 295 ms 6020 KB Output is correct
43 Correct 280 ms 5964 KB Output is correct
44 Correct 282 ms 6208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4036 KB Output is correct
2 Correct 8 ms 4028 KB Output is correct
3 Correct 8 ms 4048 KB Output is correct
4 Correct 8 ms 4120 KB Output is correct
5 Correct 8 ms 3992 KB Output is correct
6 Correct 8 ms 4108 KB Output is correct
7 Correct 12 ms 3988 KB Output is correct
8 Correct 16 ms 4416 KB Output is correct
9 Correct 18 ms 4376 KB Output is correct
10 Correct 16 ms 4292 KB Output is correct
11 Correct 16 ms 4464 KB Output is correct
12 Correct 18 ms 4416 KB Output is correct
13 Correct 17 ms 4528 KB Output is correct
14 Correct 28 ms 4552 KB Output is correct
15 Correct 41 ms 4672 KB Output is correct
16 Correct 45 ms 4720 KB Output is correct
17 Correct 40 ms 4704 KB Output is correct
18 Correct 40 ms 4708 KB Output is correct
19 Correct 43 ms 4872 KB Output is correct
20 Correct 40 ms 4816 KB Output is correct
21 Correct 61 ms 4856 KB Output is correct
22 Correct 95 ms 5260 KB Output is correct
23 Correct 84 ms 5092 KB Output is correct
24 Correct 86 ms 5104 KB Output is correct
25 Correct 90 ms 5112 KB Output is correct
26 Correct 87 ms 5136 KB Output is correct
27 Correct 89 ms 5180 KB Output is correct
28 Correct 85 ms 5192 KB Output is correct
29 Correct 127 ms 5188 KB Output is correct
30 Correct 157 ms 5376 KB Output is correct
31 Correct 168 ms 5336 KB Output is correct
32 Correct 163 ms 5396 KB Output is correct
33 Correct 165 ms 5400 KB Output is correct
34 Correct 161 ms 5384 KB Output is correct
35 Correct 171 ms 5384 KB Output is correct
36 Correct 165 ms 5364 KB Output is correct
37 Correct 222 ms 5768 KB Output is correct
38 Correct 278 ms 6000 KB Output is correct
39 Correct 280 ms 6124 KB Output is correct
40 Correct 283 ms 5952 KB Output is correct
41 Correct 279 ms 6060 KB Output is correct
42 Correct 295 ms 6020 KB Output is correct
43 Correct 280 ms 5964 KB Output is correct
44 Correct 282 ms 6208 KB Output is correct
45 Correct 356 ms 6232 KB Output is correct
46 Correct 462 ms 6372 KB Output is correct
47 Correct 453 ms 6388 KB Output is correct
48 Correct 428 ms 6300 KB Output is correct
49 Correct 424 ms 6360 KB Output is correct
50 Correct 457 ms 6448 KB Output is correct
51 Correct 452 ms 6376 KB Output is correct
52 Correct 451 ms 6408 KB Output is correct
53 Correct 438 ms 6456 KB Output is correct
54 Correct 440 ms 6340 KB Output is correct
55 Correct 433 ms 6364 KB Output is correct
56 Correct 440 ms 6528 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4036 KB Output is correct
2 Correct 8 ms 4028 KB Output is correct
3 Correct 8 ms 4048 KB Output is correct
4 Correct 8 ms 4120 KB Output is correct
5 Correct 8 ms 3992 KB Output is correct
6 Correct 8 ms 4108 KB Output is correct
7 Correct 12 ms 3988 KB Output is correct
8 Correct 16 ms 4416 KB Output is correct
9 Correct 18 ms 4376 KB Output is correct
10 Correct 16 ms 4292 KB Output is correct
11 Correct 16 ms 4464 KB Output is correct
12 Correct 18 ms 4416 KB Output is correct
13 Correct 17 ms 4528 KB Output is correct
14 Correct 28 ms 4552 KB Output is correct
15 Correct 41 ms 4672 KB Output is correct
16 Correct 45 ms 4720 KB Output is correct
17 Correct 40 ms 4704 KB Output is correct
18 Correct 40 ms 4708 KB Output is correct
19 Correct 43 ms 4872 KB Output is correct
20 Correct 40 ms 4816 KB Output is correct
21 Correct 61 ms 4856 KB Output is correct
22 Correct 95 ms 5260 KB Output is correct
23 Correct 84 ms 5092 KB Output is correct
24 Correct 86 ms 5104 KB Output is correct
25 Correct 90 ms 5112 KB Output is correct
26 Correct 87 ms 5136 KB Output is correct
27 Correct 89 ms 5180 KB Output is correct
28 Correct 85 ms 5192 KB Output is correct
29 Correct 127 ms 5188 KB Output is correct
30 Correct 157 ms 5376 KB Output is correct
31 Correct 168 ms 5336 KB Output is correct
32 Correct 163 ms 5396 KB Output is correct
33 Correct 165 ms 5400 KB Output is correct
34 Correct 161 ms 5384 KB Output is correct
35 Correct 171 ms 5384 KB Output is correct
36 Correct 165 ms 5364 KB Output is correct
37 Correct 222 ms 5768 KB Output is correct
38 Correct 278 ms 6000 KB Output is correct
39 Correct 280 ms 6124 KB Output is correct
40 Correct 283 ms 5952 KB Output is correct
41 Correct 279 ms 6060 KB Output is correct
42 Correct 295 ms 6020 KB Output is correct
43 Correct 280 ms 5964 KB Output is correct
44 Correct 282 ms 6208 KB Output is correct
45 Correct 356 ms 6232 KB Output is correct
46 Correct 462 ms 6372 KB Output is correct
47 Correct 453 ms 6388 KB Output is correct
48 Correct 428 ms 6300 KB Output is correct
49 Correct 424 ms 6360 KB Output is correct
50 Correct 457 ms 6448 KB Output is correct
51 Correct 452 ms 6376 KB Output is correct
52 Correct 451 ms 6408 KB Output is correct
53 Correct 438 ms 6456 KB Output is correct
54 Correct 440 ms 6340 KB Output is correct
55 Correct 433 ms 6364 KB Output is correct
56 Correct 440 ms 6528 KB Output is correct
57 Correct 549 ms 6776 KB Output is correct
58 Correct 639 ms 7020 KB Output is correct
59 Correct 663 ms 7092 KB Output is correct
60 Correct 673 ms 7036 KB Output is correct
61 Correct 653 ms 7052 KB Output is correct
62 Correct 672 ms 7128 KB Output is correct
63 Correct 661 ms 7072 KB Output is correct
64 Correct 678 ms 6932 KB Output is correct
65 Correct 662 ms 7004 KB Output is correct
66 Correct 668 ms 6936 KB Output is correct
67 Correct 654 ms 7060 KB Output is correct
68 Correct 671 ms 7080 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4036 KB Output is correct
2 Correct 8 ms 4028 KB Output is correct
3 Correct 8 ms 4048 KB Output is correct
4 Correct 8 ms 4120 KB Output is correct
5 Correct 8 ms 3992 KB Output is correct
6 Correct 8 ms 4108 KB Output is correct
7 Correct 12 ms 3988 KB Output is correct
8 Correct 16 ms 4416 KB Output is correct
9 Correct 18 ms 4376 KB Output is correct
10 Correct 16 ms 4292 KB Output is correct
11 Correct 16 ms 4464 KB Output is correct
12 Correct 18 ms 4416 KB Output is correct
13 Correct 17 ms 4528 KB Output is correct
14 Correct 28 ms 4552 KB Output is correct
15 Correct 41 ms 4672 KB Output is correct
16 Correct 45 ms 4720 KB Output is correct
17 Correct 40 ms 4704 KB Output is correct
18 Correct 40 ms 4708 KB Output is correct
19 Correct 43 ms 4872 KB Output is correct
20 Correct 40 ms 4816 KB Output is correct
21 Correct 61 ms 4856 KB Output is correct
22 Correct 95 ms 5260 KB Output is correct
23 Correct 84 ms 5092 KB Output is correct
24 Correct 86 ms 5104 KB Output is correct
25 Correct 90 ms 5112 KB Output is correct
26 Correct 87 ms 5136 KB Output is correct
27 Correct 89 ms 5180 KB Output is correct
28 Correct 85 ms 5192 KB Output is correct
29 Correct 127 ms 5188 KB Output is correct
30 Correct 157 ms 5376 KB Output is correct
31 Correct 168 ms 5336 KB Output is correct
32 Correct 163 ms 5396 KB Output is correct
33 Correct 165 ms 5400 KB Output is correct
34 Correct 161 ms 5384 KB Output is correct
35 Correct 171 ms 5384 KB Output is correct
36 Correct 165 ms 5364 KB Output is correct
37 Correct 222 ms 5768 KB Output is correct
38 Correct 278 ms 6000 KB Output is correct
39 Correct 280 ms 6124 KB Output is correct
40 Correct 283 ms 5952 KB Output is correct
41 Correct 279 ms 6060 KB Output is correct
42 Correct 295 ms 6020 KB Output is correct
43 Correct 280 ms 5964 KB Output is correct
44 Correct 282 ms 6208 KB Output is correct
45 Correct 356 ms 6232 KB Output is correct
46 Correct 462 ms 6372 KB Output is correct
47 Correct 453 ms 6388 KB Output is correct
48 Correct 428 ms 6300 KB Output is correct
49 Correct 424 ms 6360 KB Output is correct
50 Correct 457 ms 6448 KB Output is correct
51 Correct 452 ms 6376 KB Output is correct
52 Correct 451 ms 6408 KB Output is correct
53 Correct 438 ms 6456 KB Output is correct
54 Correct 440 ms 6340 KB Output is correct
55 Correct 433 ms 6364 KB Output is correct
56 Correct 440 ms 6528 KB Output is correct
57 Correct 549 ms 6776 KB Output is correct
58 Correct 639 ms 7020 KB Output is correct
59 Correct 663 ms 7092 KB Output is correct
60 Correct 673 ms 7036 KB Output is correct
61 Correct 653 ms 7052 KB Output is correct
62 Correct 672 ms 7128 KB Output is correct
63 Correct 661 ms 7072 KB Output is correct
64 Correct 678 ms 6932 KB Output is correct
65 Correct 662 ms 7004 KB Output is correct
66 Correct 668 ms 6936 KB Output is correct
67 Correct 654 ms 7060 KB Output is correct
68 Correct 671 ms 7080 KB Output is correct
69 Correct 788 ms 7392 KB Output is correct
70 Correct 928 ms 7604 KB Output is correct
71 Correct 929 ms 7656 KB Output is correct
72 Correct 932 ms 7776 KB Output is correct
73 Correct 940 ms 7704 KB Output is correct
74 Correct 949 ms 7596 KB Output is correct
75 Correct 928 ms 7616 KB Output is correct
76 Correct 921 ms 7784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 4036 KB Output is correct
2 Correct 8 ms 4028 KB Output is correct
3 Correct 8 ms 4048 KB Output is correct
4 Correct 8 ms 4120 KB Output is correct
5 Correct 8 ms 3992 KB Output is correct
6 Correct 8 ms 4108 KB Output is correct
7 Correct 12 ms 3988 KB Output is correct
8 Correct 16 ms 4416 KB Output is correct
9 Correct 18 ms 4376 KB Output is correct
10 Correct 16 ms 4292 KB Output is correct
11 Correct 16 ms 4464 KB Output is correct
12 Correct 18 ms 4416 KB Output is correct
13 Correct 17 ms 4528 KB Output is correct
14 Correct 28 ms 4552 KB Output is correct
15 Correct 41 ms 4672 KB Output is correct
16 Correct 45 ms 4720 KB Output is correct
17 Correct 40 ms 4704 KB Output is correct
18 Correct 40 ms 4708 KB Output is correct
19 Correct 43 ms 4872 KB Output is correct
20 Correct 40 ms 4816 KB Output is correct
21 Correct 61 ms 4856 KB Output is correct
22 Correct 95 ms 5260 KB Output is correct
23 Correct 84 ms 5092 KB Output is correct
24 Correct 86 ms 5104 KB Output is correct
25 Correct 90 ms 5112 KB Output is correct
26 Correct 87 ms 5136 KB Output is correct
27 Correct 89 ms 5180 KB Output is correct
28 Correct 85 ms 5192 KB Output is correct
29 Correct 127 ms 5188 KB Output is correct
30 Correct 157 ms 5376 KB Output is correct
31 Correct 168 ms 5336 KB Output is correct
32 Correct 163 ms 5396 KB Output is correct
33 Correct 165 ms 5400 KB Output is correct
34 Correct 161 ms 5384 KB Output is correct
35 Correct 171 ms 5384 KB Output is correct
36 Correct 165 ms 5364 KB Output is correct
37 Correct 222 ms 5768 KB Output is correct
38 Correct 278 ms 6000 KB Output is correct
39 Correct 280 ms 6124 KB Output is correct
40 Correct 283 ms 5952 KB Output is correct
41 Correct 279 ms 6060 KB Output is correct
42 Correct 295 ms 6020 KB Output is correct
43 Correct 280 ms 5964 KB Output is correct
44 Correct 282 ms 6208 KB Output is correct
45 Correct 356 ms 6232 KB Output is correct
46 Correct 462 ms 6372 KB Output is correct
47 Correct 453 ms 6388 KB Output is correct
48 Correct 428 ms 6300 KB Output is correct
49 Correct 424 ms 6360 KB Output is correct
50 Correct 457 ms 6448 KB Output is correct
51 Correct 452 ms 6376 KB Output is correct
52 Correct 451 ms 6408 KB Output is correct
53 Correct 438 ms 6456 KB Output is correct
54 Correct 440 ms 6340 KB Output is correct
55 Correct 433 ms 6364 KB Output is correct
56 Correct 440 ms 6528 KB Output is correct
57 Correct 549 ms 6776 KB Output is correct
58 Correct 639 ms 7020 KB Output is correct
59 Correct 663 ms 7092 KB Output is correct
60 Correct 673 ms 7036 KB Output is correct
61 Correct 653 ms 7052 KB Output is correct
62 Correct 672 ms 7128 KB Output is correct
63 Correct 661 ms 7072 KB Output is correct
64 Correct 678 ms 6932 KB Output is correct
65 Correct 662 ms 7004 KB Output is correct
66 Correct 668 ms 6936 KB Output is correct
67 Correct 654 ms 7060 KB Output is correct
68 Correct 671 ms 7080 KB Output is correct
69 Correct 788 ms 7392 KB Output is correct
70 Correct 928 ms 7604 KB Output is correct
71 Correct 929 ms 7656 KB Output is correct
72 Correct 932 ms 7776 KB Output is correct
73 Correct 940 ms 7704 KB Output is correct
74 Correct 949 ms 7596 KB Output is correct
75 Correct 928 ms 7616 KB Output is correct
76 Correct 921 ms 7784 KB Output is correct
77 Correct 938 ms 7596 KB Output is correct
78 Correct 1262 ms 8408 KB Output is correct
79 Correct 1269 ms 8312 KB Output is correct
80 Correct 1271 ms 8432 KB Output is correct
81 Correct 1310 ms 8356 KB Output is correct
82 Correct 1272 ms 8392 KB Output is correct
83 Correct 1257 ms 8276 KB Output is correct
84 Correct 1257 ms 8392 KB Output is correct