Submission #525735

# Submission time Handle Problem Language Result Execution time Memory
525735 2022-02-12T16:50:08 Z koioi.org-koosaga Mountains and Valleys (CCO20_day1problem3) C++17
16 / 25
7000 ms 25744 KB
#include <bits/stdc++.h>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef long long lint;
typedef pair<lint, lint> pi;
const int MAXN = 500005;

struct edge{
	int s, e, x;
};

int n, m;
vector<int> gph[MAXN];
int par[20][MAXN], dep[MAXN];

int lca(int x, int y){
	if(dep[x] > dep[y]) swap(x, y);
	int dx = dep[y] - dep[x];
	for(int i = 0; dx; i++){
		if(dx & 1) y = par[i][y];
		dx >>= 1;
	}
	for(int i = 19; i >= 0; i--){
		if(par[i][x] != par[i][y]){
			x = par[i][x];
			y = par[i][y];
		}
	}
	if(x != y) return par[0][x];
	return x;
}

void dfs(int x, int p = -1){
	for(auto &y : gph[x]){
		if(y == p) continue;
		par[0][y] = x;
		dep[y] = dep[x] + 1;
		dfs(y, x);
	}
}

bool vis[MAXN];

pi dfsl(int x, int p = -1){
	pi ret(0, x);
	for(auto &y : gph[x]){
		if(y == p || vis[y]) continue;
		auto ans = dfsl(y, x);
		ans.first++;
		ret = max(ret, ans);
	}
	return ret;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n >> m;
	vector<edge> qry;
	for(int i = 0; i < m; i++){
		int s, e, x; cin >> s >> e >> x;
		if(x == 1){
			gph[s].push_back(e);
			gph[e].push_back(s);
		}
		else{
			qry.push_back({s, e, x});
		}
	}
	dfs(0);
	for(int i = 1; i < 20; i++){
		for(int j = 0; j < n; j++){
			par[i][j] = par[i-1][par[i-1][j]];
		}
	}
	int diam = dfsl(dfsl(0).second).first;
	int ans = 2 * n - 2 - diam;
	for(auto &x : qry){
		int l = lca(x.s, x.e);
		vector<int> v, w;
		for(int i = x.s; i != l; i = par[0][i]) v.push_back(i);
		for(int i = x.e; i != l; i = par[0][i]) w.push_back(i);
		reverse(all(w));
		v.push_back(l);
		for(auto &i : w) v.push_back(i);
		for(auto &i : v) vis[i] = 1;
		vector<int> val;
		vector<int> ndiam;
		int maxPath = -1e9;
		for(auto &i : v){
			vis[i] = 0;
			val.push_back(dfsl(i).first);
			int ndiam = dfsl(dfsl(i).second).first;
			maxPath = max(maxPath, ndiam - 3 + sz(v));
			vis[i] = 1;
		}
		for(auto &i : v) vis[i] = 0;
		int pmax = -1e9;
		for(int i = 0; i < sz(val); i++){
			maxPath = max(maxPath, sz(val) - 1 - i + val[i] + pmax);
			pmax = max(pmax, i + val[i]);
		}
		ans = min(ans, 2 * n - 4 + x.x - maxPath);
	}
	cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 6 ms 12108 KB Output is correct
2 Correct 7 ms 12108 KB Output is correct
3 Correct 6 ms 12108 KB Output is correct
4 Correct 7 ms 12108 KB Output is correct
5 Correct 6 ms 12108 KB Output is correct
6 Correct 6 ms 12108 KB Output is correct
7 Correct 7 ms 12200 KB Output is correct
8 Correct 6 ms 12108 KB Output is correct
9 Correct 6 ms 12108 KB Output is correct
10 Correct 7 ms 12108 KB Output is correct
11 Correct 7 ms 12108 KB Output is correct
12 Correct 6 ms 12108 KB Output is correct
13 Correct 6 ms 12156 KB Output is correct
14 Correct 6 ms 12120 KB Output is correct
15 Correct 6 ms 12124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 12108 KB Output is correct
2 Correct 7 ms 12108 KB Output is correct
3 Correct 6 ms 12108 KB Output is correct
4 Correct 7 ms 12108 KB Output is correct
5 Correct 6 ms 12108 KB Output is correct
6 Correct 6 ms 12108 KB Output is correct
7 Correct 7 ms 12200 KB Output is correct
8 Correct 6 ms 12108 KB Output is correct
9 Correct 6 ms 12108 KB Output is correct
10 Correct 7 ms 12108 KB Output is correct
11 Correct 7 ms 12108 KB Output is correct
12 Correct 6 ms 12108 KB Output is correct
13 Correct 6 ms 12156 KB Output is correct
14 Correct 6 ms 12120 KB Output is correct
15 Correct 6 ms 12124 KB Output is correct
16 Correct 6 ms 12108 KB Output is correct
17 Correct 6 ms 12108 KB Output is correct
18 Correct 6 ms 12108 KB Output is correct
19 Correct 6 ms 12108 KB Output is correct
20 Correct 7 ms 12108 KB Output is correct
21 Correct 7 ms 12108 KB Output is correct
22 Correct 7 ms 12108 KB Output is correct
23 Correct 6 ms 12200 KB Output is correct
24 Correct 7 ms 12108 KB Output is correct
25 Correct 7 ms 12108 KB Output is correct
26 Correct 6 ms 12108 KB Output is correct
27 Correct 6 ms 12108 KB Output is correct
28 Correct 8 ms 12108 KB Output is correct
29 Correct 6 ms 12108 KB Output is correct
30 Correct 8 ms 12164 KB Output is correct
31 Correct 6 ms 12108 KB Output is correct
32 Correct 6 ms 12108 KB Output is correct
33 Correct 6 ms 12148 KB Output is correct
34 Correct 6 ms 12112 KB Output is correct
35 Correct 7 ms 12152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1096 ms 13256 KB Output is correct
2 Correct 933 ms 13380 KB Output is correct
3 Correct 1112 ms 13116 KB Output is correct
4 Correct 1288 ms 13060 KB Output is correct
5 Correct 1344 ms 13004 KB Output is correct
6 Correct 353 ms 12904 KB Output is correct
7 Correct 975 ms 13272 KB Output is correct
8 Correct 946 ms 13104 KB Output is correct
9 Correct 995 ms 13252 KB Output is correct
10 Correct 1360 ms 13068 KB Output is correct
11 Correct 1293 ms 13116 KB Output is correct
12 Correct 1214 ms 13044 KB Output is correct
13 Correct 1338 ms 13136 KB Output is correct
14 Correct 1283 ms 13124 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 12108 KB Output is correct
2 Correct 7 ms 12108 KB Output is correct
3 Correct 6 ms 12108 KB Output is correct
4 Correct 7 ms 12108 KB Output is correct
5 Correct 6 ms 12108 KB Output is correct
6 Correct 6 ms 12108 KB Output is correct
7 Correct 7 ms 12200 KB Output is correct
8 Correct 6 ms 12108 KB Output is correct
9 Correct 6 ms 12108 KB Output is correct
10 Correct 7 ms 12108 KB Output is correct
11 Correct 7 ms 12108 KB Output is correct
12 Correct 6 ms 12108 KB Output is correct
13 Correct 6 ms 12156 KB Output is correct
14 Correct 6 ms 12120 KB Output is correct
15 Correct 6 ms 12124 KB Output is correct
16 Correct 6 ms 12108 KB Output is correct
17 Correct 6 ms 12108 KB Output is correct
18 Correct 6 ms 12108 KB Output is correct
19 Correct 6 ms 12108 KB Output is correct
20 Correct 7 ms 12108 KB Output is correct
21 Correct 7 ms 12108 KB Output is correct
22 Correct 7 ms 12108 KB Output is correct
23 Correct 6 ms 12200 KB Output is correct
24 Correct 7 ms 12108 KB Output is correct
25 Correct 7 ms 12108 KB Output is correct
26 Correct 6 ms 12108 KB Output is correct
27 Correct 6 ms 12108 KB Output is correct
28 Correct 8 ms 12108 KB Output is correct
29 Correct 6 ms 12108 KB Output is correct
30 Correct 8 ms 12164 KB Output is correct
31 Correct 6 ms 12108 KB Output is correct
32 Correct 6 ms 12108 KB Output is correct
33 Correct 6 ms 12148 KB Output is correct
34 Correct 6 ms 12112 KB Output is correct
35 Correct 7 ms 12152 KB Output is correct
36 Correct 7 ms 12108 KB Output is correct
37 Correct 7 ms 12108 KB Output is correct
38 Correct 6 ms 12108 KB Output is correct
39 Correct 6 ms 12184 KB Output is correct
40 Correct 7 ms 12108 KB Output is correct
41 Correct 7 ms 12108 KB Output is correct
42 Correct 7 ms 12108 KB Output is correct
43 Correct 7 ms 12108 KB Output is correct
44 Correct 7 ms 12108 KB Output is correct
45 Correct 7 ms 12108 KB Output is correct
46 Correct 7 ms 12108 KB Output is correct
47 Correct 7 ms 12108 KB Output is correct
48 Correct 6 ms 12116 KB Output is correct
49 Correct 7 ms 12108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 12108 KB Output is correct
2 Correct 7 ms 12108 KB Output is correct
3 Correct 6 ms 12108 KB Output is correct
4 Correct 7 ms 12108 KB Output is correct
5 Correct 6 ms 12108 KB Output is correct
6 Correct 6 ms 12108 KB Output is correct
7 Correct 7 ms 12200 KB Output is correct
8 Correct 6 ms 12108 KB Output is correct
9 Correct 6 ms 12108 KB Output is correct
10 Correct 7 ms 12108 KB Output is correct
11 Correct 7 ms 12108 KB Output is correct
12 Correct 6 ms 12108 KB Output is correct
13 Correct 6 ms 12156 KB Output is correct
14 Correct 6 ms 12120 KB Output is correct
15 Correct 6 ms 12124 KB Output is correct
16 Correct 6 ms 12108 KB Output is correct
17 Correct 6 ms 12108 KB Output is correct
18 Correct 6 ms 12108 KB Output is correct
19 Correct 6 ms 12108 KB Output is correct
20 Correct 7 ms 12108 KB Output is correct
21 Correct 7 ms 12108 KB Output is correct
22 Correct 7 ms 12108 KB Output is correct
23 Correct 6 ms 12200 KB Output is correct
24 Correct 7 ms 12108 KB Output is correct
25 Correct 7 ms 12108 KB Output is correct
26 Correct 6 ms 12108 KB Output is correct
27 Correct 6 ms 12108 KB Output is correct
28 Correct 8 ms 12108 KB Output is correct
29 Correct 6 ms 12108 KB Output is correct
30 Correct 8 ms 12164 KB Output is correct
31 Correct 6 ms 12108 KB Output is correct
32 Correct 6 ms 12108 KB Output is correct
33 Correct 6 ms 12148 KB Output is correct
34 Correct 6 ms 12112 KB Output is correct
35 Correct 7 ms 12152 KB Output is correct
36 Correct 7 ms 12108 KB Output is correct
37 Correct 7 ms 12108 KB Output is correct
38 Correct 6 ms 12108 KB Output is correct
39 Correct 6 ms 12184 KB Output is correct
40 Correct 7 ms 12108 KB Output is correct
41 Correct 7 ms 12108 KB Output is correct
42 Correct 7 ms 12108 KB Output is correct
43 Correct 7 ms 12108 KB Output is correct
44 Correct 7 ms 12108 KB Output is correct
45 Correct 7 ms 12108 KB Output is correct
46 Correct 7 ms 12108 KB Output is correct
47 Correct 7 ms 12108 KB Output is correct
48 Correct 6 ms 12116 KB Output is correct
49 Correct 7 ms 12108 KB Output is correct
50 Correct 19 ms 12252 KB Output is correct
51 Correct 16 ms 12236 KB Output is correct
52 Correct 16 ms 12364 KB Output is correct
53 Correct 15 ms 12236 KB Output is correct
54 Correct 18 ms 12216 KB Output is correct
55 Correct 11 ms 12236 KB Output is correct
56 Correct 15 ms 12320 KB Output is correct
57 Correct 15 ms 12192 KB Output is correct
58 Correct 15 ms 12236 KB Output is correct
59 Correct 16 ms 12236 KB Output is correct
60 Correct 15 ms 12304 KB Output is correct
61 Correct 15 ms 12304 KB Output is correct
62 Correct 8 ms 12236 KB Output is correct
63 Correct 8 ms 12268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 12108 KB Output is correct
2 Correct 7 ms 12108 KB Output is correct
3 Correct 6 ms 12108 KB Output is correct
4 Correct 7 ms 12108 KB Output is correct
5 Correct 6 ms 12108 KB Output is correct
6 Correct 6 ms 12108 KB Output is correct
7 Correct 7 ms 12200 KB Output is correct
8 Correct 6 ms 12108 KB Output is correct
9 Correct 6 ms 12108 KB Output is correct
10 Correct 7 ms 12108 KB Output is correct
11 Correct 7 ms 12108 KB Output is correct
12 Correct 6 ms 12108 KB Output is correct
13 Correct 6 ms 12156 KB Output is correct
14 Correct 6 ms 12120 KB Output is correct
15 Correct 6 ms 12124 KB Output is correct
16 Correct 6 ms 12108 KB Output is correct
17 Correct 6 ms 12108 KB Output is correct
18 Correct 6 ms 12108 KB Output is correct
19 Correct 6 ms 12108 KB Output is correct
20 Correct 7 ms 12108 KB Output is correct
21 Correct 7 ms 12108 KB Output is correct
22 Correct 7 ms 12108 KB Output is correct
23 Correct 6 ms 12200 KB Output is correct
24 Correct 7 ms 12108 KB Output is correct
25 Correct 7 ms 12108 KB Output is correct
26 Correct 6 ms 12108 KB Output is correct
27 Correct 6 ms 12108 KB Output is correct
28 Correct 8 ms 12108 KB Output is correct
29 Correct 6 ms 12108 KB Output is correct
30 Correct 8 ms 12164 KB Output is correct
31 Correct 6 ms 12108 KB Output is correct
32 Correct 6 ms 12108 KB Output is correct
33 Correct 6 ms 12148 KB Output is correct
34 Correct 6 ms 12112 KB Output is correct
35 Correct 7 ms 12152 KB Output is correct
36 Correct 1096 ms 13256 KB Output is correct
37 Correct 933 ms 13380 KB Output is correct
38 Correct 1112 ms 13116 KB Output is correct
39 Correct 1288 ms 13060 KB Output is correct
40 Correct 1344 ms 13004 KB Output is correct
41 Correct 353 ms 12904 KB Output is correct
42 Correct 975 ms 13272 KB Output is correct
43 Correct 946 ms 13104 KB Output is correct
44 Correct 995 ms 13252 KB Output is correct
45 Correct 1360 ms 13068 KB Output is correct
46 Correct 1293 ms 13116 KB Output is correct
47 Correct 1214 ms 13044 KB Output is correct
48 Correct 1338 ms 13136 KB Output is correct
49 Correct 1283 ms 13124 KB Output is correct
50 Correct 7 ms 12108 KB Output is correct
51 Correct 7 ms 12108 KB Output is correct
52 Correct 6 ms 12108 KB Output is correct
53 Correct 6 ms 12184 KB Output is correct
54 Correct 7 ms 12108 KB Output is correct
55 Correct 7 ms 12108 KB Output is correct
56 Correct 7 ms 12108 KB Output is correct
57 Correct 7 ms 12108 KB Output is correct
58 Correct 7 ms 12108 KB Output is correct
59 Correct 7 ms 12108 KB Output is correct
60 Correct 7 ms 12108 KB Output is correct
61 Correct 7 ms 12108 KB Output is correct
62 Correct 6 ms 12116 KB Output is correct
63 Correct 7 ms 12108 KB Output is correct
64 Correct 19 ms 12252 KB Output is correct
65 Correct 16 ms 12236 KB Output is correct
66 Correct 16 ms 12364 KB Output is correct
67 Correct 15 ms 12236 KB Output is correct
68 Correct 18 ms 12216 KB Output is correct
69 Correct 11 ms 12236 KB Output is correct
70 Correct 15 ms 12320 KB Output is correct
71 Correct 15 ms 12192 KB Output is correct
72 Correct 15 ms 12236 KB Output is correct
73 Correct 16 ms 12236 KB Output is correct
74 Correct 15 ms 12304 KB Output is correct
75 Correct 15 ms 12304 KB Output is correct
76 Correct 8 ms 12236 KB Output is correct
77 Correct 8 ms 12268 KB Output is correct
78 Correct 1198 ms 13260 KB Output is correct
79 Correct 957 ms 13268 KB Output is correct
80 Correct 1130 ms 13132 KB Output is correct
81 Correct 1266 ms 13064 KB Output is correct
82 Correct 1332 ms 13012 KB Output is correct
83 Correct 352 ms 12896 KB Output is correct
84 Correct 1050 ms 13272 KB Output is correct
85 Correct 1069 ms 13124 KB Output is correct
86 Correct 1084 ms 13220 KB Output is correct
87 Correct 1222 ms 13124 KB Output is correct
88 Correct 1172 ms 13132 KB Output is correct
89 Correct 1184 ms 13056 KB Output is correct
90 Correct 219 ms 13008 KB Output is correct
91 Correct 214 ms 13004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 12108 KB Output is correct
2 Correct 7 ms 12108 KB Output is correct
3 Correct 6 ms 12108 KB Output is correct
4 Correct 7 ms 12108 KB Output is correct
5 Correct 6 ms 12108 KB Output is correct
6 Correct 6 ms 12108 KB Output is correct
7 Correct 7 ms 12200 KB Output is correct
8 Correct 6 ms 12108 KB Output is correct
9 Correct 6 ms 12108 KB Output is correct
10 Correct 7 ms 12108 KB Output is correct
11 Correct 7 ms 12108 KB Output is correct
12 Correct 6 ms 12108 KB Output is correct
13 Correct 6 ms 12156 KB Output is correct
14 Correct 6 ms 12120 KB Output is correct
15 Correct 6 ms 12124 KB Output is correct
16 Correct 6 ms 12108 KB Output is correct
17 Correct 6 ms 12108 KB Output is correct
18 Correct 6 ms 12108 KB Output is correct
19 Correct 6 ms 12108 KB Output is correct
20 Correct 7 ms 12108 KB Output is correct
21 Correct 7 ms 12108 KB Output is correct
22 Correct 7 ms 12108 KB Output is correct
23 Correct 6 ms 12200 KB Output is correct
24 Correct 7 ms 12108 KB Output is correct
25 Correct 7 ms 12108 KB Output is correct
26 Correct 6 ms 12108 KB Output is correct
27 Correct 6 ms 12108 KB Output is correct
28 Correct 8 ms 12108 KB Output is correct
29 Correct 6 ms 12108 KB Output is correct
30 Correct 8 ms 12164 KB Output is correct
31 Correct 6 ms 12108 KB Output is correct
32 Correct 6 ms 12108 KB Output is correct
33 Correct 6 ms 12148 KB Output is correct
34 Correct 6 ms 12112 KB Output is correct
35 Correct 7 ms 12152 KB Output is correct
36 Correct 1096 ms 13256 KB Output is correct
37 Correct 933 ms 13380 KB Output is correct
38 Correct 1112 ms 13116 KB Output is correct
39 Correct 1288 ms 13060 KB Output is correct
40 Correct 1344 ms 13004 KB Output is correct
41 Correct 353 ms 12904 KB Output is correct
42 Correct 975 ms 13272 KB Output is correct
43 Correct 946 ms 13104 KB Output is correct
44 Correct 995 ms 13252 KB Output is correct
45 Correct 1360 ms 13068 KB Output is correct
46 Correct 1293 ms 13116 KB Output is correct
47 Correct 1214 ms 13044 KB Output is correct
48 Correct 1338 ms 13136 KB Output is correct
49 Correct 1283 ms 13124 KB Output is correct
50 Correct 7 ms 12108 KB Output is correct
51 Correct 7 ms 12108 KB Output is correct
52 Correct 6 ms 12108 KB Output is correct
53 Correct 6 ms 12184 KB Output is correct
54 Correct 7 ms 12108 KB Output is correct
55 Correct 7 ms 12108 KB Output is correct
56 Correct 7 ms 12108 KB Output is correct
57 Correct 7 ms 12108 KB Output is correct
58 Correct 7 ms 12108 KB Output is correct
59 Correct 7 ms 12108 KB Output is correct
60 Correct 7 ms 12108 KB Output is correct
61 Correct 7 ms 12108 KB Output is correct
62 Correct 6 ms 12116 KB Output is correct
63 Correct 7 ms 12108 KB Output is correct
64 Correct 19 ms 12252 KB Output is correct
65 Correct 16 ms 12236 KB Output is correct
66 Correct 16 ms 12364 KB Output is correct
67 Correct 15 ms 12236 KB Output is correct
68 Correct 18 ms 12216 KB Output is correct
69 Correct 11 ms 12236 KB Output is correct
70 Correct 15 ms 12320 KB Output is correct
71 Correct 15 ms 12192 KB Output is correct
72 Correct 15 ms 12236 KB Output is correct
73 Correct 16 ms 12236 KB Output is correct
74 Correct 15 ms 12304 KB Output is correct
75 Correct 15 ms 12304 KB Output is correct
76 Correct 8 ms 12236 KB Output is correct
77 Correct 8 ms 12268 KB Output is correct
78 Correct 1198 ms 13260 KB Output is correct
79 Correct 957 ms 13268 KB Output is correct
80 Correct 1130 ms 13132 KB Output is correct
81 Correct 1266 ms 13064 KB Output is correct
82 Correct 1332 ms 13012 KB Output is correct
83 Correct 352 ms 12896 KB Output is correct
84 Correct 1050 ms 13272 KB Output is correct
85 Correct 1069 ms 13124 KB Output is correct
86 Correct 1084 ms 13220 KB Output is correct
87 Correct 1222 ms 13124 KB Output is correct
88 Correct 1172 ms 13132 KB Output is correct
89 Correct 1184 ms 13056 KB Output is correct
90 Correct 219 ms 13008 KB Output is correct
91 Correct 214 ms 13004 KB Output is correct
92 Execution timed out 7095 ms 25744 KB Time limit exceeded
93 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 12108 KB Output is correct
2 Correct 7 ms 12108 KB Output is correct
3 Correct 6 ms 12108 KB Output is correct
4 Correct 7 ms 12108 KB Output is correct
5 Correct 6 ms 12108 KB Output is correct
6 Correct 6 ms 12108 KB Output is correct
7 Correct 7 ms 12200 KB Output is correct
8 Correct 6 ms 12108 KB Output is correct
9 Correct 6 ms 12108 KB Output is correct
10 Correct 7 ms 12108 KB Output is correct
11 Correct 7 ms 12108 KB Output is correct
12 Correct 6 ms 12108 KB Output is correct
13 Correct 6 ms 12156 KB Output is correct
14 Correct 6 ms 12120 KB Output is correct
15 Correct 6 ms 12124 KB Output is correct
16 Correct 6 ms 12108 KB Output is correct
17 Correct 6 ms 12108 KB Output is correct
18 Correct 6 ms 12108 KB Output is correct
19 Correct 6 ms 12108 KB Output is correct
20 Correct 7 ms 12108 KB Output is correct
21 Correct 7 ms 12108 KB Output is correct
22 Correct 7 ms 12108 KB Output is correct
23 Correct 6 ms 12200 KB Output is correct
24 Correct 7 ms 12108 KB Output is correct
25 Correct 7 ms 12108 KB Output is correct
26 Correct 6 ms 12108 KB Output is correct
27 Correct 6 ms 12108 KB Output is correct
28 Correct 8 ms 12108 KB Output is correct
29 Correct 6 ms 12108 KB Output is correct
30 Correct 8 ms 12164 KB Output is correct
31 Correct 6 ms 12108 KB Output is correct
32 Correct 6 ms 12108 KB Output is correct
33 Correct 6 ms 12148 KB Output is correct
34 Correct 6 ms 12112 KB Output is correct
35 Correct 7 ms 12152 KB Output is correct
36 Correct 1096 ms 13256 KB Output is correct
37 Correct 933 ms 13380 KB Output is correct
38 Correct 1112 ms 13116 KB Output is correct
39 Correct 1288 ms 13060 KB Output is correct
40 Correct 1344 ms 13004 KB Output is correct
41 Correct 353 ms 12904 KB Output is correct
42 Correct 975 ms 13272 KB Output is correct
43 Correct 946 ms 13104 KB Output is correct
44 Correct 995 ms 13252 KB Output is correct
45 Correct 1360 ms 13068 KB Output is correct
46 Correct 1293 ms 13116 KB Output is correct
47 Correct 1214 ms 13044 KB Output is correct
48 Correct 1338 ms 13136 KB Output is correct
49 Correct 1283 ms 13124 KB Output is correct
50 Correct 7 ms 12108 KB Output is correct
51 Correct 7 ms 12108 KB Output is correct
52 Correct 6 ms 12108 KB Output is correct
53 Correct 6 ms 12184 KB Output is correct
54 Correct 7 ms 12108 KB Output is correct
55 Correct 7 ms 12108 KB Output is correct
56 Correct 7 ms 12108 KB Output is correct
57 Correct 7 ms 12108 KB Output is correct
58 Correct 7 ms 12108 KB Output is correct
59 Correct 7 ms 12108 KB Output is correct
60 Correct 7 ms 12108 KB Output is correct
61 Correct 7 ms 12108 KB Output is correct
62 Correct 6 ms 12116 KB Output is correct
63 Correct 7 ms 12108 KB Output is correct
64 Correct 19 ms 12252 KB Output is correct
65 Correct 16 ms 12236 KB Output is correct
66 Correct 16 ms 12364 KB Output is correct
67 Correct 15 ms 12236 KB Output is correct
68 Correct 18 ms 12216 KB Output is correct
69 Correct 11 ms 12236 KB Output is correct
70 Correct 15 ms 12320 KB Output is correct
71 Correct 15 ms 12192 KB Output is correct
72 Correct 15 ms 12236 KB Output is correct
73 Correct 16 ms 12236 KB Output is correct
74 Correct 15 ms 12304 KB Output is correct
75 Correct 15 ms 12304 KB Output is correct
76 Correct 8 ms 12236 KB Output is correct
77 Correct 8 ms 12268 KB Output is correct
78 Correct 1198 ms 13260 KB Output is correct
79 Correct 957 ms 13268 KB Output is correct
80 Correct 1130 ms 13132 KB Output is correct
81 Correct 1266 ms 13064 KB Output is correct
82 Correct 1332 ms 13012 KB Output is correct
83 Correct 352 ms 12896 KB Output is correct
84 Correct 1050 ms 13272 KB Output is correct
85 Correct 1069 ms 13124 KB Output is correct
86 Correct 1084 ms 13220 KB Output is correct
87 Correct 1222 ms 13124 KB Output is correct
88 Correct 1172 ms 13132 KB Output is correct
89 Correct 1184 ms 13056 KB Output is correct
90 Correct 219 ms 13008 KB Output is correct
91 Correct 214 ms 13004 KB Output is correct
92 Execution timed out 7095 ms 25744 KB Time limit exceeded
93 Halted 0 ms 0 KB -