Submission #578511

# Submission time Handle Problem Language Result Execution time Memory
578511 2022-06-17T07:44:43 Z 8e7 Mars (APIO22_mars) C++17
100 / 100
1294 ms 4908 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 105
#define mod 998244353
#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];	
		}
		debug(k);
		debug(s);
		debug(mid);
		debug(t);

		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);	
			//debug("edge", u, v);
		};
		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]];		
					//debug("t", i, seg[i], last[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++;
					debug("dfs s", i);
					dfs(2*maxn + i, cur);
				}
			}
			upper = cur;
		}
		
		for (int i = 0;i < 2 * l + 1;i++) {
			if (mid[i] == '1' && !vis[maxn + i]) {
				cnt++;
				debug("dfs mid", i);
				dfs(maxn + i, 0);
			}
		}
		for (int i = 0;i < 2 * l - 1;i++) {
			if (t[i] == '1' && !vis[i]) {
				cnt++;
				debug("dfs t", i);
				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';
			}
			debug("vec");
			for (auto p:vec) debug(p.ff, p.ss);
			debug();
			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';
		}
		debug(k, ret);

	} else {
		propagate(X == m);
	}
	return ret;
}
/*
1
3
0 1 1 0 0 1 1
1 0 0 1 0 0 1
1 1 0 0 1 1 0
0 0 0 1 1 1 1
0 0 1 1 0 0 0
0 1 0 0 1 1 1
1 1 1 0 0 0 0

1 2
1 1 1 0 0
1 0 1 0 0
1 1 1 0 1
0 0 0 0 1
0 0 1 1 1

*/

Compilation message

mars.cpp: In function 'std::string process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:62:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   62 |    for (int i = 0;i < s.size();i++) ret[i] = s[i];
      |                   ~~^~~~~~~~~~
mars.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
mars.cpp:99:3: note: in expansion of macro 'debug'
   99 |   debug(k);
      |   ^~~~~
mars.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
mars.cpp:100:3: note: in expansion of macro 'debug'
  100 |   debug(s);
      |   ^~~~~
mars.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
mars.cpp:101:3: note: in expansion of macro 'debug'
  101 |   debug(mid);
      |   ^~~~~
mars.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
mars.cpp:102:3: note: in expansion of macro 'debug'
  102 |   debug(t);
      |   ^~~~~
mars.cpp:144:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  144 |    for (int i = 0;i < t.size();i++) {
      |                   ~~^~~~~~~~~~
mars.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
mars.cpp:173:6: note: in expansion of macro 'debug'
  173 |      debug("dfs s", i);
      |      ^~~~~
mars.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
mars.cpp:183:5: note: in expansion of macro 'debug'
  183 |     debug("dfs mid", i);
      |     ^~~~~
mars.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
mars.cpp:190:5: note: in expansion of macro 'debug'
  190 |     debug("dfs t", i);
      |     ^~~~~
mars.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
mars.cpp:218:4: note: in expansion of macro 'debug'
  218 |    debug("vec");
      |    ^~~~~
mars.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
mars.cpp:219:21: note: in expansion of macro 'debug'
  219 |    for (auto p:vec) debug(p.ff, p.ss);
      |                     ^~~~~
mars.cpp:219:14: warning: variable 'p' set but not used [-Wunused-but-set-variable]
  219 |    for (auto p:vec) debug(p.ff, p.ss);
      |              ^
mars.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
mars.cpp:220:4: note: in expansion of macro 'debug'
  220 |    debug();
      |    ^~~~~
mars.cpp:15:20: warning: statement has no effect [-Wunused-value]
   15 | #define debug(...) 0
      |                    ^
mars.cpp:240:3: note: in expansion of macro 'debug'
  240 |   debug(k, ret);
      |   ^~~~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1924 KB Output is correct
2 Correct 8 ms 1956 KB Output is correct
3 Correct 7 ms 2036 KB Output is correct
4 Correct 8 ms 2092 KB Output is correct
5 Correct 8 ms 2308 KB Output is correct
6 Correct 8 ms 2220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1924 KB Output is correct
2 Correct 8 ms 1956 KB Output is correct
3 Correct 7 ms 2036 KB Output is correct
4 Correct 8 ms 2092 KB Output is correct
5 Correct 8 ms 2308 KB Output is correct
6 Correct 8 ms 2220 KB Output is correct
7 Correct 11 ms 2280 KB Output is correct
8 Correct 17 ms 2368 KB Output is correct
9 Correct 16 ms 2472 KB Output is correct
10 Correct 16 ms 2352 KB Output is correct
11 Correct 16 ms 2336 KB Output is correct
12 Correct 17 ms 2296 KB Output is correct
13 Correct 17 ms 2432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1924 KB Output is correct
2 Correct 8 ms 1956 KB Output is correct
3 Correct 7 ms 2036 KB Output is correct
4 Correct 8 ms 2092 KB Output is correct
5 Correct 8 ms 2308 KB Output is correct
6 Correct 8 ms 2220 KB Output is correct
7 Correct 11 ms 2280 KB Output is correct
8 Correct 17 ms 2368 KB Output is correct
9 Correct 16 ms 2472 KB Output is correct
10 Correct 16 ms 2352 KB Output is correct
11 Correct 16 ms 2336 KB Output is correct
12 Correct 17 ms 2296 KB Output is correct
13 Correct 17 ms 2432 KB Output is correct
14 Correct 30 ms 2516 KB Output is correct
15 Correct 40 ms 2688 KB Output is correct
16 Correct 43 ms 2744 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2692 KB Output is correct
19 Correct 43 ms 2692 KB Output is correct
20 Correct 43 ms 2660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1924 KB Output is correct
2 Correct 8 ms 1956 KB Output is correct
3 Correct 7 ms 2036 KB Output is correct
4 Correct 8 ms 2092 KB Output is correct
5 Correct 8 ms 2308 KB Output is correct
6 Correct 8 ms 2220 KB Output is correct
7 Correct 11 ms 2280 KB Output is correct
8 Correct 17 ms 2368 KB Output is correct
9 Correct 16 ms 2472 KB Output is correct
10 Correct 16 ms 2352 KB Output is correct
11 Correct 16 ms 2336 KB Output is correct
12 Correct 17 ms 2296 KB Output is correct
13 Correct 17 ms 2432 KB Output is correct
14 Correct 30 ms 2516 KB Output is correct
15 Correct 40 ms 2688 KB Output is correct
16 Correct 43 ms 2744 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2692 KB Output is correct
19 Correct 43 ms 2692 KB Output is correct
20 Correct 43 ms 2660 KB Output is correct
21 Correct 64 ms 2616 KB Output is correct
22 Correct 89 ms 2768 KB Output is correct
23 Correct 94 ms 2824 KB Output is correct
24 Correct 89 ms 2836 KB Output is correct
25 Correct 87 ms 2760 KB Output is correct
26 Correct 85 ms 2804 KB Output is correct
27 Correct 92 ms 2744 KB Output is correct
28 Correct 89 ms 2864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1924 KB Output is correct
2 Correct 8 ms 1956 KB Output is correct
3 Correct 7 ms 2036 KB Output is correct
4 Correct 8 ms 2092 KB Output is correct
5 Correct 8 ms 2308 KB Output is correct
6 Correct 8 ms 2220 KB Output is correct
7 Correct 11 ms 2280 KB Output is correct
8 Correct 17 ms 2368 KB Output is correct
9 Correct 16 ms 2472 KB Output is correct
10 Correct 16 ms 2352 KB Output is correct
11 Correct 16 ms 2336 KB Output is correct
12 Correct 17 ms 2296 KB Output is correct
13 Correct 17 ms 2432 KB Output is correct
14 Correct 30 ms 2516 KB Output is correct
15 Correct 40 ms 2688 KB Output is correct
16 Correct 43 ms 2744 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2692 KB Output is correct
19 Correct 43 ms 2692 KB Output is correct
20 Correct 43 ms 2660 KB Output is correct
21 Correct 64 ms 2616 KB Output is correct
22 Correct 89 ms 2768 KB Output is correct
23 Correct 94 ms 2824 KB Output is correct
24 Correct 89 ms 2836 KB Output is correct
25 Correct 87 ms 2760 KB Output is correct
26 Correct 85 ms 2804 KB Output is correct
27 Correct 92 ms 2744 KB Output is correct
28 Correct 89 ms 2864 KB Output is correct
29 Correct 133 ms 2936 KB Output is correct
30 Correct 169 ms 3048 KB Output is correct
31 Correct 172 ms 2976 KB Output is correct
32 Correct 176 ms 2928 KB Output is correct
33 Correct 167 ms 2936 KB Output is correct
34 Correct 167 ms 2912 KB Output is correct
35 Correct 182 ms 2984 KB Output is correct
36 Correct 173 ms 2932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1924 KB Output is correct
2 Correct 8 ms 1956 KB Output is correct
3 Correct 7 ms 2036 KB Output is correct
4 Correct 8 ms 2092 KB Output is correct
5 Correct 8 ms 2308 KB Output is correct
6 Correct 8 ms 2220 KB Output is correct
7 Correct 11 ms 2280 KB Output is correct
8 Correct 17 ms 2368 KB Output is correct
9 Correct 16 ms 2472 KB Output is correct
10 Correct 16 ms 2352 KB Output is correct
11 Correct 16 ms 2336 KB Output is correct
12 Correct 17 ms 2296 KB Output is correct
13 Correct 17 ms 2432 KB Output is correct
14 Correct 30 ms 2516 KB Output is correct
15 Correct 40 ms 2688 KB Output is correct
16 Correct 43 ms 2744 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2692 KB Output is correct
19 Correct 43 ms 2692 KB Output is correct
20 Correct 43 ms 2660 KB Output is correct
21 Correct 64 ms 2616 KB Output is correct
22 Correct 89 ms 2768 KB Output is correct
23 Correct 94 ms 2824 KB Output is correct
24 Correct 89 ms 2836 KB Output is correct
25 Correct 87 ms 2760 KB Output is correct
26 Correct 85 ms 2804 KB Output is correct
27 Correct 92 ms 2744 KB Output is correct
28 Correct 89 ms 2864 KB Output is correct
29 Correct 133 ms 2936 KB Output is correct
30 Correct 169 ms 3048 KB Output is correct
31 Correct 172 ms 2976 KB Output is correct
32 Correct 176 ms 2928 KB Output is correct
33 Correct 167 ms 2936 KB Output is correct
34 Correct 167 ms 2912 KB Output is correct
35 Correct 182 ms 2984 KB Output is correct
36 Correct 173 ms 2932 KB Output is correct
37 Correct 236 ms 3320 KB Output is correct
38 Correct 273 ms 3320 KB Output is correct
39 Correct 316 ms 3388 KB Output is correct
40 Correct 283 ms 3380 KB Output is correct
41 Correct 301 ms 3412 KB Output is correct
42 Correct 282 ms 3380 KB Output is correct
43 Correct 296 ms 3356 KB Output is correct
44 Correct 284 ms 3380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1924 KB Output is correct
2 Correct 8 ms 1956 KB Output is correct
3 Correct 7 ms 2036 KB Output is correct
4 Correct 8 ms 2092 KB Output is correct
5 Correct 8 ms 2308 KB Output is correct
6 Correct 8 ms 2220 KB Output is correct
7 Correct 11 ms 2280 KB Output is correct
8 Correct 17 ms 2368 KB Output is correct
9 Correct 16 ms 2472 KB Output is correct
10 Correct 16 ms 2352 KB Output is correct
11 Correct 16 ms 2336 KB Output is correct
12 Correct 17 ms 2296 KB Output is correct
13 Correct 17 ms 2432 KB Output is correct
14 Correct 30 ms 2516 KB Output is correct
15 Correct 40 ms 2688 KB Output is correct
16 Correct 43 ms 2744 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2692 KB Output is correct
19 Correct 43 ms 2692 KB Output is correct
20 Correct 43 ms 2660 KB Output is correct
21 Correct 64 ms 2616 KB Output is correct
22 Correct 89 ms 2768 KB Output is correct
23 Correct 94 ms 2824 KB Output is correct
24 Correct 89 ms 2836 KB Output is correct
25 Correct 87 ms 2760 KB Output is correct
26 Correct 85 ms 2804 KB Output is correct
27 Correct 92 ms 2744 KB Output is correct
28 Correct 89 ms 2864 KB Output is correct
29 Correct 133 ms 2936 KB Output is correct
30 Correct 169 ms 3048 KB Output is correct
31 Correct 172 ms 2976 KB Output is correct
32 Correct 176 ms 2928 KB Output is correct
33 Correct 167 ms 2936 KB Output is correct
34 Correct 167 ms 2912 KB Output is correct
35 Correct 182 ms 2984 KB Output is correct
36 Correct 173 ms 2932 KB Output is correct
37 Correct 236 ms 3320 KB Output is correct
38 Correct 273 ms 3320 KB Output is correct
39 Correct 316 ms 3388 KB Output is correct
40 Correct 283 ms 3380 KB Output is correct
41 Correct 301 ms 3412 KB Output is correct
42 Correct 282 ms 3380 KB Output is correct
43 Correct 296 ms 3356 KB Output is correct
44 Correct 284 ms 3380 KB Output is correct
45 Correct 380 ms 3496 KB Output is correct
46 Correct 464 ms 3592 KB Output is correct
47 Correct 468 ms 3760 KB Output is correct
48 Correct 471 ms 3512 KB Output is correct
49 Correct 466 ms 3560 KB Output is correct
50 Correct 450 ms 3448 KB Output is correct
51 Correct 451 ms 3516 KB Output is correct
52 Correct 463 ms 3484 KB Output is correct
53 Correct 453 ms 3520 KB Output is correct
54 Correct 456 ms 3700 KB Output is correct
55 Correct 454 ms 3604 KB Output is correct
56 Correct 458 ms 3484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1924 KB Output is correct
2 Correct 8 ms 1956 KB Output is correct
3 Correct 7 ms 2036 KB Output is correct
4 Correct 8 ms 2092 KB Output is correct
5 Correct 8 ms 2308 KB Output is correct
6 Correct 8 ms 2220 KB Output is correct
7 Correct 11 ms 2280 KB Output is correct
8 Correct 17 ms 2368 KB Output is correct
9 Correct 16 ms 2472 KB Output is correct
10 Correct 16 ms 2352 KB Output is correct
11 Correct 16 ms 2336 KB Output is correct
12 Correct 17 ms 2296 KB Output is correct
13 Correct 17 ms 2432 KB Output is correct
14 Correct 30 ms 2516 KB Output is correct
15 Correct 40 ms 2688 KB Output is correct
16 Correct 43 ms 2744 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2692 KB Output is correct
19 Correct 43 ms 2692 KB Output is correct
20 Correct 43 ms 2660 KB Output is correct
21 Correct 64 ms 2616 KB Output is correct
22 Correct 89 ms 2768 KB Output is correct
23 Correct 94 ms 2824 KB Output is correct
24 Correct 89 ms 2836 KB Output is correct
25 Correct 87 ms 2760 KB Output is correct
26 Correct 85 ms 2804 KB Output is correct
27 Correct 92 ms 2744 KB Output is correct
28 Correct 89 ms 2864 KB Output is correct
29 Correct 133 ms 2936 KB Output is correct
30 Correct 169 ms 3048 KB Output is correct
31 Correct 172 ms 2976 KB Output is correct
32 Correct 176 ms 2928 KB Output is correct
33 Correct 167 ms 2936 KB Output is correct
34 Correct 167 ms 2912 KB Output is correct
35 Correct 182 ms 2984 KB Output is correct
36 Correct 173 ms 2932 KB Output is correct
37 Correct 236 ms 3320 KB Output is correct
38 Correct 273 ms 3320 KB Output is correct
39 Correct 316 ms 3388 KB Output is correct
40 Correct 283 ms 3380 KB Output is correct
41 Correct 301 ms 3412 KB Output is correct
42 Correct 282 ms 3380 KB Output is correct
43 Correct 296 ms 3356 KB Output is correct
44 Correct 284 ms 3380 KB Output is correct
45 Correct 380 ms 3496 KB Output is correct
46 Correct 464 ms 3592 KB Output is correct
47 Correct 468 ms 3760 KB Output is correct
48 Correct 471 ms 3512 KB Output is correct
49 Correct 466 ms 3560 KB Output is correct
50 Correct 450 ms 3448 KB Output is correct
51 Correct 451 ms 3516 KB Output is correct
52 Correct 463 ms 3484 KB Output is correct
53 Correct 453 ms 3520 KB Output is correct
54 Correct 456 ms 3700 KB Output is correct
55 Correct 454 ms 3604 KB Output is correct
56 Correct 458 ms 3484 KB Output is correct
57 Correct 554 ms 3764 KB Output is correct
58 Correct 688 ms 4200 KB Output is correct
59 Correct 661 ms 4132 KB Output is correct
60 Correct 659 ms 4028 KB Output is correct
61 Correct 659 ms 4132 KB Output is correct
62 Correct 656 ms 4152 KB Output is correct
63 Correct 649 ms 4216 KB Output is correct
64 Correct 651 ms 4200 KB Output is correct
65 Correct 657 ms 4248 KB Output is correct
66 Correct 656 ms 4280 KB Output is correct
67 Correct 663 ms 4140 KB Output is correct
68 Correct 657 ms 4152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1924 KB Output is correct
2 Correct 8 ms 1956 KB Output is correct
3 Correct 7 ms 2036 KB Output is correct
4 Correct 8 ms 2092 KB Output is correct
5 Correct 8 ms 2308 KB Output is correct
6 Correct 8 ms 2220 KB Output is correct
7 Correct 11 ms 2280 KB Output is correct
8 Correct 17 ms 2368 KB Output is correct
9 Correct 16 ms 2472 KB Output is correct
10 Correct 16 ms 2352 KB Output is correct
11 Correct 16 ms 2336 KB Output is correct
12 Correct 17 ms 2296 KB Output is correct
13 Correct 17 ms 2432 KB Output is correct
14 Correct 30 ms 2516 KB Output is correct
15 Correct 40 ms 2688 KB Output is correct
16 Correct 43 ms 2744 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2692 KB Output is correct
19 Correct 43 ms 2692 KB Output is correct
20 Correct 43 ms 2660 KB Output is correct
21 Correct 64 ms 2616 KB Output is correct
22 Correct 89 ms 2768 KB Output is correct
23 Correct 94 ms 2824 KB Output is correct
24 Correct 89 ms 2836 KB Output is correct
25 Correct 87 ms 2760 KB Output is correct
26 Correct 85 ms 2804 KB Output is correct
27 Correct 92 ms 2744 KB Output is correct
28 Correct 89 ms 2864 KB Output is correct
29 Correct 133 ms 2936 KB Output is correct
30 Correct 169 ms 3048 KB Output is correct
31 Correct 172 ms 2976 KB Output is correct
32 Correct 176 ms 2928 KB Output is correct
33 Correct 167 ms 2936 KB Output is correct
34 Correct 167 ms 2912 KB Output is correct
35 Correct 182 ms 2984 KB Output is correct
36 Correct 173 ms 2932 KB Output is correct
37 Correct 236 ms 3320 KB Output is correct
38 Correct 273 ms 3320 KB Output is correct
39 Correct 316 ms 3388 KB Output is correct
40 Correct 283 ms 3380 KB Output is correct
41 Correct 301 ms 3412 KB Output is correct
42 Correct 282 ms 3380 KB Output is correct
43 Correct 296 ms 3356 KB Output is correct
44 Correct 284 ms 3380 KB Output is correct
45 Correct 380 ms 3496 KB Output is correct
46 Correct 464 ms 3592 KB Output is correct
47 Correct 468 ms 3760 KB Output is correct
48 Correct 471 ms 3512 KB Output is correct
49 Correct 466 ms 3560 KB Output is correct
50 Correct 450 ms 3448 KB Output is correct
51 Correct 451 ms 3516 KB Output is correct
52 Correct 463 ms 3484 KB Output is correct
53 Correct 453 ms 3520 KB Output is correct
54 Correct 456 ms 3700 KB Output is correct
55 Correct 454 ms 3604 KB Output is correct
56 Correct 458 ms 3484 KB Output is correct
57 Correct 554 ms 3764 KB Output is correct
58 Correct 688 ms 4200 KB Output is correct
59 Correct 661 ms 4132 KB Output is correct
60 Correct 659 ms 4028 KB Output is correct
61 Correct 659 ms 4132 KB Output is correct
62 Correct 656 ms 4152 KB Output is correct
63 Correct 649 ms 4216 KB Output is correct
64 Correct 651 ms 4200 KB Output is correct
65 Correct 657 ms 4248 KB Output is correct
66 Correct 656 ms 4280 KB Output is correct
67 Correct 663 ms 4140 KB Output is correct
68 Correct 657 ms 4152 KB Output is correct
69 Correct 788 ms 4372 KB Output is correct
70 Correct 932 ms 4448 KB Output is correct
71 Correct 945 ms 4304 KB Output is correct
72 Correct 948 ms 4344 KB Output is correct
73 Correct 921 ms 4380 KB Output is correct
74 Correct 933 ms 4304 KB Output is correct
75 Correct 930 ms 4400 KB Output is correct
76 Correct 936 ms 4504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1924 KB Output is correct
2 Correct 8 ms 1956 KB Output is correct
3 Correct 7 ms 2036 KB Output is correct
4 Correct 8 ms 2092 KB Output is correct
5 Correct 8 ms 2308 KB Output is correct
6 Correct 8 ms 2220 KB Output is correct
7 Correct 11 ms 2280 KB Output is correct
8 Correct 17 ms 2368 KB Output is correct
9 Correct 16 ms 2472 KB Output is correct
10 Correct 16 ms 2352 KB Output is correct
11 Correct 16 ms 2336 KB Output is correct
12 Correct 17 ms 2296 KB Output is correct
13 Correct 17 ms 2432 KB Output is correct
14 Correct 30 ms 2516 KB Output is correct
15 Correct 40 ms 2688 KB Output is correct
16 Correct 43 ms 2744 KB Output is correct
17 Correct 43 ms 2568 KB Output is correct
18 Correct 41 ms 2692 KB Output is correct
19 Correct 43 ms 2692 KB Output is correct
20 Correct 43 ms 2660 KB Output is correct
21 Correct 64 ms 2616 KB Output is correct
22 Correct 89 ms 2768 KB Output is correct
23 Correct 94 ms 2824 KB Output is correct
24 Correct 89 ms 2836 KB Output is correct
25 Correct 87 ms 2760 KB Output is correct
26 Correct 85 ms 2804 KB Output is correct
27 Correct 92 ms 2744 KB Output is correct
28 Correct 89 ms 2864 KB Output is correct
29 Correct 133 ms 2936 KB Output is correct
30 Correct 169 ms 3048 KB Output is correct
31 Correct 172 ms 2976 KB Output is correct
32 Correct 176 ms 2928 KB Output is correct
33 Correct 167 ms 2936 KB Output is correct
34 Correct 167 ms 2912 KB Output is correct
35 Correct 182 ms 2984 KB Output is correct
36 Correct 173 ms 2932 KB Output is correct
37 Correct 236 ms 3320 KB Output is correct
38 Correct 273 ms 3320 KB Output is correct
39 Correct 316 ms 3388 KB Output is correct
40 Correct 283 ms 3380 KB Output is correct
41 Correct 301 ms 3412 KB Output is correct
42 Correct 282 ms 3380 KB Output is correct
43 Correct 296 ms 3356 KB Output is correct
44 Correct 284 ms 3380 KB Output is correct
45 Correct 380 ms 3496 KB Output is correct
46 Correct 464 ms 3592 KB Output is correct
47 Correct 468 ms 3760 KB Output is correct
48 Correct 471 ms 3512 KB Output is correct
49 Correct 466 ms 3560 KB Output is correct
50 Correct 450 ms 3448 KB Output is correct
51 Correct 451 ms 3516 KB Output is correct
52 Correct 463 ms 3484 KB Output is correct
53 Correct 453 ms 3520 KB Output is correct
54 Correct 456 ms 3700 KB Output is correct
55 Correct 454 ms 3604 KB Output is correct
56 Correct 458 ms 3484 KB Output is correct
57 Correct 554 ms 3764 KB Output is correct
58 Correct 688 ms 4200 KB Output is correct
59 Correct 661 ms 4132 KB Output is correct
60 Correct 659 ms 4028 KB Output is correct
61 Correct 659 ms 4132 KB Output is correct
62 Correct 656 ms 4152 KB Output is correct
63 Correct 649 ms 4216 KB Output is correct
64 Correct 651 ms 4200 KB Output is correct
65 Correct 657 ms 4248 KB Output is correct
66 Correct 656 ms 4280 KB Output is correct
67 Correct 663 ms 4140 KB Output is correct
68 Correct 657 ms 4152 KB Output is correct
69 Correct 788 ms 4372 KB Output is correct
70 Correct 932 ms 4448 KB Output is correct
71 Correct 945 ms 4304 KB Output is correct
72 Correct 948 ms 4344 KB Output is correct
73 Correct 921 ms 4380 KB Output is correct
74 Correct 933 ms 4304 KB Output is correct
75 Correct 930 ms 4400 KB Output is correct
76 Correct 936 ms 4504 KB Output is correct
77 Correct 933 ms 4296 KB Output is correct
78 Correct 1282 ms 4732 KB Output is correct
79 Correct 1278 ms 4660 KB Output is correct
80 Correct 1224 ms 4828 KB Output is correct
81 Correct 1281 ms 4612 KB Output is correct
82 Correct 1294 ms 4908 KB Output is correct
83 Correct 1272 ms 4740 KB Output is correct
84 Correct 1278 ms 4752 KB Output is correct