답안 #525882

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
525882 2022-02-13T05:42:13 Z koioi.org-koosaga Mountains and Valleys (CCO20_day1problem3) C++17
21 / 25
7000 ms 395492 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;
}

struct node{
	int lmax, rmax, opt, len;
	node():
	lmax(-1e9), rmax(-1e9), opt(-1e9), len(0) {}
	node(int x):
	lmax(x), rmax(x), opt(-1e9), len(1) {}

	node(int a, int b, int c, int e):
	lmax(a), rmax(b), opt(c), len(e) {}

	node reverse(){
		return node(rmax, lmax, opt, len);
	}
	node operator+(const node &n)const{
		return node(
			max(lmax - n.len, n.lmax),
			max(rmax, n.rmax - len),
			max({opt, n.opt, lmax + n.rmax - 1}),
			len + n.len);
	};
};

vector<int> ord;
int din[MAXN], dout[MAXN], piv;
int far[MAXN], diam[MAXN], pfar[MAXN], pdiam[MAXN];
int f[20][MAXN];
node g[20][MAXN];
vector<pi> fars[MAXN];
vector<pi> subDiams[MAXN];

int fPathMax(int x, int v){
	int ans = -1e9;
	for(int i = 0; v; i++){
		if(v & 1){
			ans = max(ans, f[i][x]);
			x = par[i][x];
		}
		v >>= 1;
	}
	return ans;
}

node gPathSum(int x, int v){
	node gs;
	for(int i = 0; v; i++){
		if(v & 1){
			gs = gs + g[i][x];
			x = par[i][x];
		}
		v >>= 1;
	}
	return gs;
}

bool in(int u, int v){
	return din[u] <= din[v] && dout[v] <= dout[u];
}

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

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]];
		}
	}
	{
		reverse(all(ord));
		for(auto &i : ord){
			for(auto &j : gph[i]){
				if(j == par[0][i]) continue;
				far[i] = max(far[i], far[j] + 1);
				diam[i] = max({diam[i], diam[j], far[j] + 1});
				fars[i].emplace_back(far[j], j);
			}
			sort(all(fars[i]));
			reverse(all(fars[i]));
			if(sz(fars[i]) >= 2) diam[i] = max(diam[i], (int)fars[i][0].first + (int)fars[i][1].first + 2);
		}
		reverse(all(ord));
		for(auto &i : ord){
			if(i == 0) continue;
			for(auto &j : fars[par[0][i]]){
				if(j.second == i) continue;
				pfar[i] = j.first + 1;
				break;
			}
			fars[i].emplace_back(pfar[i], par[0][i]);
			sort(all(fars[i]));
			reverse(all(fars[i]));
		}	
		for(auto &i : ord){
			if(i == 0) continue;
			for(auto &[d, v] : subDiams[par[0][i]]){
				if(v == i) continue;
				pdiam[i] = max(pdiam[i], (int)d);
				break;
			}
			{
				int new_diam = 0;
				int cnt = 0;
				for(auto &[d, v] : fars[par[0][i]]){
					if(v == i) continue;
					new_diam += d + 1;
					cnt += 1;
					if(cnt == 2) break;
				}
				pdiam[i] = max(pdiam[i], new_diam);
			}
			for(auto &j : gph[i]){
				if(j == par[0][i]) subDiams[i].emplace_back(pdiam[i], j);
				else subDiams[i].emplace_back(diam[j], j);
			}
			sort(all(subDiams[i]));
			reverse(all(subDiams[i]));
		}
		for(int i = 0; i < n; i++){
			if(dep[i] >= 2){
				int cnt = 0;
				int gi = 0;
				for(auto &[d, v] : fars[par[0][i]]){
					if(v == i || v == par[1][i]) continue;
					gi = max(gi, (int)d + 1);
					f[0][i] += d + 1;
					cnt++;
					if(cnt == 2) break;
				}
				for(auto &[d, v] : subDiams[par[0][i]]){
					if(v == i || v == par[1][i]) continue;
					f[0][i] = max(f[0][i], (int)d);
					break;
				}
				g[0][i] = node(gi);
			}
		}
		for(int i = 1; i < 20; i++){
			for(int j = 0; j < n; j++){
				f[i][j] = max(f[i-1][j], f[i-1][par[i-1][j]]);
				g[i][j] = g[i-1][j] + g[i-1][par[i-1][j]];
			}
		}
	}
	int ans = 2 * n - 2 - diam[0];
	for(auto &x : qry){
		int l = lca(x.s, x.e);
		int plen = dep[x.s] + dep[x.e] - 2 * dep[l] + 1;
		int maxPath = -1e9;
		if(dep[x.s] >= dep[l] + 2){
			maxPath = max(maxPath, fPathMax(x.s, dep[x.s] - dep[l] - 1) - 3 + plen);
		}
		if(dep[x.e] >= dep[l] + 2){
			maxPath = max(maxPath, fPathMax(x.e, dep[x.e] - dep[l] - 1) - 3 + plen);
		}
		if(l != x.s){
			maxPath = max(maxPath, diam[x.s] - 3 + plen);
		}
		if(l != x.e){
			maxPath = max(maxPath, diam[x.e] - 3 + plen);
		}
		{
			int new_diam = 0;
			int cnt = 0;
			// passes through l
			for(auto &[d, v] : fars[l]){
				if((in(v, x.s) || in(v, x.e)) && v != par[0][l]) continue;
				new_diam += d + 1;
				cnt += 1;
				if(cnt == 2) break;
			}
			for(auto &[d, v] : subDiams[l]){
				if((in(v, x.s) || in(v, x.e)) && v != par[0][l]) continue;
				new_diam = max(new_diam, (int)d);
				break;
			}
			maxPath = max(maxPath, new_diam - 3 + plen);
		}
		// TODO: qn.
		node valup, valdown;
		if(x.s != l) valup = valup + node(far[x.s]);
		if(x.e != l) valdown = valdown + node(far[x.e]);
		if(dep[x.s] >= dep[l] + 2){
			valup = valup + gPathSum(x.s, dep[x.s] - dep[l] - 1);
		}
		if(dep[x.e] >= dep[l] + 2){
			valdown = valdown + gPathSum(x.e, dep[x.e] - dep[l] - 1);
		}
		{
			int dist = 0;
			for(auto &[d, v] : fars[l]){
				if((in(v, x.s) || in(v, x.e)) && v != par[0][l]) continue;
				dist = max(dist, (int)d + 1);
				break;
			}
			valup = valup + node(dist);
		}
		node val = valup + valdown.reverse();
		maxPath = max(maxPath, val.opt + val.len - 1);
		ans = min(ans, 2 * n - 4 + x.x - maxPath);
	}
	cout << ans << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 192324 KB Output is correct
2 Correct 84 ms 192404 KB Output is correct
3 Correct 79 ms 192324 KB Output is correct
4 Correct 78 ms 192328 KB Output is correct
5 Correct 88 ms 192392 KB Output is correct
6 Correct 87 ms 192428 KB Output is correct
7 Correct 79 ms 192368 KB Output is correct
8 Correct 84 ms 192540 KB Output is correct
9 Correct 81 ms 192396 KB Output is correct
10 Correct 79 ms 192324 KB Output is correct
11 Correct 83 ms 192388 KB Output is correct
12 Correct 80 ms 192388 KB Output is correct
13 Correct 79 ms 192324 KB Output is correct
14 Correct 84 ms 192440 KB Output is correct
15 Correct 93 ms 192324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 192324 KB Output is correct
2 Correct 84 ms 192404 KB Output is correct
3 Correct 79 ms 192324 KB Output is correct
4 Correct 78 ms 192328 KB Output is correct
5 Correct 88 ms 192392 KB Output is correct
6 Correct 87 ms 192428 KB Output is correct
7 Correct 79 ms 192368 KB Output is correct
8 Correct 84 ms 192540 KB Output is correct
9 Correct 81 ms 192396 KB Output is correct
10 Correct 79 ms 192324 KB Output is correct
11 Correct 83 ms 192388 KB Output is correct
12 Correct 80 ms 192388 KB Output is correct
13 Correct 79 ms 192324 KB Output is correct
14 Correct 84 ms 192440 KB Output is correct
15 Correct 93 ms 192324 KB Output is correct
16 Correct 79 ms 192420 KB Output is correct
17 Correct 80 ms 192424 KB Output is correct
18 Correct 81 ms 192416 KB Output is correct
19 Correct 80 ms 192372 KB Output is correct
20 Correct 88 ms 192332 KB Output is correct
21 Correct 98 ms 192324 KB Output is correct
22 Correct 79 ms 192436 KB Output is correct
23 Correct 79 ms 192324 KB Output is correct
24 Correct 80 ms 192360 KB Output is correct
25 Correct 82 ms 192480 KB Output is correct
26 Correct 80 ms 192452 KB Output is correct
27 Correct 80 ms 192452 KB Output is correct
28 Correct 78 ms 192404 KB Output is correct
29 Correct 79 ms 192348 KB Output is correct
30 Correct 85 ms 192340 KB Output is correct
31 Correct 80 ms 192448 KB Output is correct
32 Correct 78 ms 192424 KB Output is correct
33 Correct 79 ms 192324 KB Output is correct
34 Correct 81 ms 192452 KB Output is correct
35 Correct 79 ms 192328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 91 ms 194372 KB Output is correct
2 Correct 89 ms 194284 KB Output is correct
3 Correct 88 ms 194124 KB Output is correct
4 Correct 92 ms 194084 KB Output is correct
5 Correct 91 ms 194076 KB Output is correct
6 Correct 89 ms 194212 KB Output is correct
7 Correct 95 ms 194264 KB Output is correct
8 Correct 98 ms 194236 KB Output is correct
9 Correct 87 ms 194276 KB Output is correct
10 Correct 90 ms 194084 KB Output is correct
11 Correct 88 ms 194228 KB Output is correct
12 Correct 96 ms 194144 KB Output is correct
13 Correct 88 ms 194168 KB Output is correct
14 Correct 91 ms 194116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 192324 KB Output is correct
2 Correct 84 ms 192404 KB Output is correct
3 Correct 79 ms 192324 KB Output is correct
4 Correct 78 ms 192328 KB Output is correct
5 Correct 88 ms 192392 KB Output is correct
6 Correct 87 ms 192428 KB Output is correct
7 Correct 79 ms 192368 KB Output is correct
8 Correct 84 ms 192540 KB Output is correct
9 Correct 81 ms 192396 KB Output is correct
10 Correct 79 ms 192324 KB Output is correct
11 Correct 83 ms 192388 KB Output is correct
12 Correct 80 ms 192388 KB Output is correct
13 Correct 79 ms 192324 KB Output is correct
14 Correct 84 ms 192440 KB Output is correct
15 Correct 93 ms 192324 KB Output is correct
16 Correct 79 ms 192420 KB Output is correct
17 Correct 80 ms 192424 KB Output is correct
18 Correct 81 ms 192416 KB Output is correct
19 Correct 80 ms 192372 KB Output is correct
20 Correct 88 ms 192332 KB Output is correct
21 Correct 98 ms 192324 KB Output is correct
22 Correct 79 ms 192436 KB Output is correct
23 Correct 79 ms 192324 KB Output is correct
24 Correct 80 ms 192360 KB Output is correct
25 Correct 82 ms 192480 KB Output is correct
26 Correct 80 ms 192452 KB Output is correct
27 Correct 80 ms 192452 KB Output is correct
28 Correct 78 ms 192404 KB Output is correct
29 Correct 79 ms 192348 KB Output is correct
30 Correct 85 ms 192340 KB Output is correct
31 Correct 80 ms 192448 KB Output is correct
32 Correct 78 ms 192424 KB Output is correct
33 Correct 79 ms 192324 KB Output is correct
34 Correct 81 ms 192452 KB Output is correct
35 Correct 79 ms 192328 KB Output is correct
36 Correct 81 ms 192428 KB Output is correct
37 Correct 82 ms 192372 KB Output is correct
38 Correct 82 ms 192440 KB Output is correct
39 Correct 80 ms 192400 KB Output is correct
40 Correct 80 ms 192452 KB Output is correct
41 Correct 81 ms 192372 KB Output is correct
42 Correct 80 ms 192452 KB Output is correct
43 Correct 80 ms 192456 KB Output is correct
44 Correct 80 ms 192412 KB Output is correct
45 Correct 79 ms 192488 KB Output is correct
46 Correct 80 ms 192480 KB Output is correct
47 Correct 81 ms 192404 KB Output is correct
48 Correct 84 ms 192392 KB Output is correct
49 Correct 80 ms 192380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 192324 KB Output is correct
2 Correct 84 ms 192404 KB Output is correct
3 Correct 79 ms 192324 KB Output is correct
4 Correct 78 ms 192328 KB Output is correct
5 Correct 88 ms 192392 KB Output is correct
6 Correct 87 ms 192428 KB Output is correct
7 Correct 79 ms 192368 KB Output is correct
8 Correct 84 ms 192540 KB Output is correct
9 Correct 81 ms 192396 KB Output is correct
10 Correct 79 ms 192324 KB Output is correct
11 Correct 83 ms 192388 KB Output is correct
12 Correct 80 ms 192388 KB Output is correct
13 Correct 79 ms 192324 KB Output is correct
14 Correct 84 ms 192440 KB Output is correct
15 Correct 93 ms 192324 KB Output is correct
16 Correct 79 ms 192420 KB Output is correct
17 Correct 80 ms 192424 KB Output is correct
18 Correct 81 ms 192416 KB Output is correct
19 Correct 80 ms 192372 KB Output is correct
20 Correct 88 ms 192332 KB Output is correct
21 Correct 98 ms 192324 KB Output is correct
22 Correct 79 ms 192436 KB Output is correct
23 Correct 79 ms 192324 KB Output is correct
24 Correct 80 ms 192360 KB Output is correct
25 Correct 82 ms 192480 KB Output is correct
26 Correct 80 ms 192452 KB Output is correct
27 Correct 80 ms 192452 KB Output is correct
28 Correct 78 ms 192404 KB Output is correct
29 Correct 79 ms 192348 KB Output is correct
30 Correct 85 ms 192340 KB Output is correct
31 Correct 80 ms 192448 KB Output is correct
32 Correct 78 ms 192424 KB Output is correct
33 Correct 79 ms 192324 KB Output is correct
34 Correct 81 ms 192452 KB Output is correct
35 Correct 79 ms 192328 KB Output is correct
36 Correct 81 ms 192428 KB Output is correct
37 Correct 82 ms 192372 KB Output is correct
38 Correct 82 ms 192440 KB Output is correct
39 Correct 80 ms 192400 KB Output is correct
40 Correct 80 ms 192452 KB Output is correct
41 Correct 81 ms 192372 KB Output is correct
42 Correct 80 ms 192452 KB Output is correct
43 Correct 80 ms 192456 KB Output is correct
44 Correct 80 ms 192412 KB Output is correct
45 Correct 79 ms 192488 KB Output is correct
46 Correct 80 ms 192480 KB Output is correct
47 Correct 81 ms 192404 KB Output is correct
48 Correct 84 ms 192392 KB Output is correct
49 Correct 80 ms 192380 KB Output is correct
50 Correct 84 ms 192528 KB Output is correct
51 Correct 86 ms 192560 KB Output is correct
52 Correct 80 ms 192624 KB Output is correct
53 Correct 81 ms 192708 KB Output is correct
54 Correct 81 ms 192580 KB Output is correct
55 Correct 88 ms 192584 KB Output is correct
56 Correct 81 ms 192580 KB Output is correct
57 Correct 79 ms 192524 KB Output is correct
58 Correct 81 ms 192536 KB Output is correct
59 Correct 80 ms 192580 KB Output is correct
60 Correct 81 ms 192624 KB Output is correct
61 Correct 85 ms 192672 KB Output is correct
62 Correct 79 ms 192564 KB Output is correct
63 Correct 79 ms 192612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 192324 KB Output is correct
2 Correct 84 ms 192404 KB Output is correct
3 Correct 79 ms 192324 KB Output is correct
4 Correct 78 ms 192328 KB Output is correct
5 Correct 88 ms 192392 KB Output is correct
6 Correct 87 ms 192428 KB Output is correct
7 Correct 79 ms 192368 KB Output is correct
8 Correct 84 ms 192540 KB Output is correct
9 Correct 81 ms 192396 KB Output is correct
10 Correct 79 ms 192324 KB Output is correct
11 Correct 83 ms 192388 KB Output is correct
12 Correct 80 ms 192388 KB Output is correct
13 Correct 79 ms 192324 KB Output is correct
14 Correct 84 ms 192440 KB Output is correct
15 Correct 93 ms 192324 KB Output is correct
16 Correct 79 ms 192420 KB Output is correct
17 Correct 80 ms 192424 KB Output is correct
18 Correct 81 ms 192416 KB Output is correct
19 Correct 80 ms 192372 KB Output is correct
20 Correct 88 ms 192332 KB Output is correct
21 Correct 98 ms 192324 KB Output is correct
22 Correct 79 ms 192436 KB Output is correct
23 Correct 79 ms 192324 KB Output is correct
24 Correct 80 ms 192360 KB Output is correct
25 Correct 82 ms 192480 KB Output is correct
26 Correct 80 ms 192452 KB Output is correct
27 Correct 80 ms 192452 KB Output is correct
28 Correct 78 ms 192404 KB Output is correct
29 Correct 79 ms 192348 KB Output is correct
30 Correct 85 ms 192340 KB Output is correct
31 Correct 80 ms 192448 KB Output is correct
32 Correct 78 ms 192424 KB Output is correct
33 Correct 79 ms 192324 KB Output is correct
34 Correct 81 ms 192452 KB Output is correct
35 Correct 79 ms 192328 KB Output is correct
36 Correct 91 ms 194372 KB Output is correct
37 Correct 89 ms 194284 KB Output is correct
38 Correct 88 ms 194124 KB Output is correct
39 Correct 92 ms 194084 KB Output is correct
40 Correct 91 ms 194076 KB Output is correct
41 Correct 89 ms 194212 KB Output is correct
42 Correct 95 ms 194264 KB Output is correct
43 Correct 98 ms 194236 KB Output is correct
44 Correct 87 ms 194276 KB Output is correct
45 Correct 90 ms 194084 KB Output is correct
46 Correct 88 ms 194228 KB Output is correct
47 Correct 96 ms 194144 KB Output is correct
48 Correct 88 ms 194168 KB Output is correct
49 Correct 91 ms 194116 KB Output is correct
50 Correct 81 ms 192428 KB Output is correct
51 Correct 82 ms 192372 KB Output is correct
52 Correct 82 ms 192440 KB Output is correct
53 Correct 80 ms 192400 KB Output is correct
54 Correct 80 ms 192452 KB Output is correct
55 Correct 81 ms 192372 KB Output is correct
56 Correct 80 ms 192452 KB Output is correct
57 Correct 80 ms 192456 KB Output is correct
58 Correct 80 ms 192412 KB Output is correct
59 Correct 79 ms 192488 KB Output is correct
60 Correct 80 ms 192480 KB Output is correct
61 Correct 81 ms 192404 KB Output is correct
62 Correct 84 ms 192392 KB Output is correct
63 Correct 80 ms 192380 KB Output is correct
64 Correct 84 ms 192528 KB Output is correct
65 Correct 86 ms 192560 KB Output is correct
66 Correct 80 ms 192624 KB Output is correct
67 Correct 81 ms 192708 KB Output is correct
68 Correct 81 ms 192580 KB Output is correct
69 Correct 88 ms 192584 KB Output is correct
70 Correct 81 ms 192580 KB Output is correct
71 Correct 79 ms 192524 KB Output is correct
72 Correct 81 ms 192536 KB Output is correct
73 Correct 80 ms 192580 KB Output is correct
74 Correct 81 ms 192624 KB Output is correct
75 Correct 85 ms 192672 KB Output is correct
76 Correct 79 ms 192564 KB Output is correct
77 Correct 79 ms 192612 KB Output is correct
78 Correct 88 ms 194204 KB Output is correct
79 Correct 90 ms 194144 KB Output is correct
80 Correct 93 ms 194152 KB Output is correct
81 Correct 89 ms 194100 KB Output is correct
82 Correct 87 ms 194148 KB Output is correct
83 Correct 86 ms 193988 KB Output is correct
84 Correct 88 ms 194244 KB Output is correct
85 Correct 94 ms 194248 KB Output is correct
86 Correct 91 ms 194244 KB Output is correct
87 Correct 88 ms 194116 KB Output is correct
88 Correct 88 ms 194084 KB Output is correct
89 Correct 90 ms 194076 KB Output is correct
90 Correct 84 ms 194120 KB Output is correct
91 Correct 87 ms 194136 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 192324 KB Output is correct
2 Correct 84 ms 192404 KB Output is correct
3 Correct 79 ms 192324 KB Output is correct
4 Correct 78 ms 192328 KB Output is correct
5 Correct 88 ms 192392 KB Output is correct
6 Correct 87 ms 192428 KB Output is correct
7 Correct 79 ms 192368 KB Output is correct
8 Correct 84 ms 192540 KB Output is correct
9 Correct 81 ms 192396 KB Output is correct
10 Correct 79 ms 192324 KB Output is correct
11 Correct 83 ms 192388 KB Output is correct
12 Correct 80 ms 192388 KB Output is correct
13 Correct 79 ms 192324 KB Output is correct
14 Correct 84 ms 192440 KB Output is correct
15 Correct 93 ms 192324 KB Output is correct
16 Correct 79 ms 192420 KB Output is correct
17 Correct 80 ms 192424 KB Output is correct
18 Correct 81 ms 192416 KB Output is correct
19 Correct 80 ms 192372 KB Output is correct
20 Correct 88 ms 192332 KB Output is correct
21 Correct 98 ms 192324 KB Output is correct
22 Correct 79 ms 192436 KB Output is correct
23 Correct 79 ms 192324 KB Output is correct
24 Correct 80 ms 192360 KB Output is correct
25 Correct 82 ms 192480 KB Output is correct
26 Correct 80 ms 192452 KB Output is correct
27 Correct 80 ms 192452 KB Output is correct
28 Correct 78 ms 192404 KB Output is correct
29 Correct 79 ms 192348 KB Output is correct
30 Correct 85 ms 192340 KB Output is correct
31 Correct 80 ms 192448 KB Output is correct
32 Correct 78 ms 192424 KB Output is correct
33 Correct 79 ms 192324 KB Output is correct
34 Correct 81 ms 192452 KB Output is correct
35 Correct 79 ms 192328 KB Output is correct
36 Correct 91 ms 194372 KB Output is correct
37 Correct 89 ms 194284 KB Output is correct
38 Correct 88 ms 194124 KB Output is correct
39 Correct 92 ms 194084 KB Output is correct
40 Correct 91 ms 194076 KB Output is correct
41 Correct 89 ms 194212 KB Output is correct
42 Correct 95 ms 194264 KB Output is correct
43 Correct 98 ms 194236 KB Output is correct
44 Correct 87 ms 194276 KB Output is correct
45 Correct 90 ms 194084 KB Output is correct
46 Correct 88 ms 194228 KB Output is correct
47 Correct 96 ms 194144 KB Output is correct
48 Correct 88 ms 194168 KB Output is correct
49 Correct 91 ms 194116 KB Output is correct
50 Correct 81 ms 192428 KB Output is correct
51 Correct 82 ms 192372 KB Output is correct
52 Correct 82 ms 192440 KB Output is correct
53 Correct 80 ms 192400 KB Output is correct
54 Correct 80 ms 192452 KB Output is correct
55 Correct 81 ms 192372 KB Output is correct
56 Correct 80 ms 192452 KB Output is correct
57 Correct 80 ms 192456 KB Output is correct
58 Correct 80 ms 192412 KB Output is correct
59 Correct 79 ms 192488 KB Output is correct
60 Correct 80 ms 192480 KB Output is correct
61 Correct 81 ms 192404 KB Output is correct
62 Correct 84 ms 192392 KB Output is correct
63 Correct 80 ms 192380 KB Output is correct
64 Correct 84 ms 192528 KB Output is correct
65 Correct 86 ms 192560 KB Output is correct
66 Correct 80 ms 192624 KB Output is correct
67 Correct 81 ms 192708 KB Output is correct
68 Correct 81 ms 192580 KB Output is correct
69 Correct 88 ms 192584 KB Output is correct
70 Correct 81 ms 192580 KB Output is correct
71 Correct 79 ms 192524 KB Output is correct
72 Correct 81 ms 192536 KB Output is correct
73 Correct 80 ms 192580 KB Output is correct
74 Correct 81 ms 192624 KB Output is correct
75 Correct 85 ms 192672 KB Output is correct
76 Correct 79 ms 192564 KB Output is correct
77 Correct 79 ms 192612 KB Output is correct
78 Correct 88 ms 194204 KB Output is correct
79 Correct 90 ms 194144 KB Output is correct
80 Correct 93 ms 194152 KB Output is correct
81 Correct 89 ms 194100 KB Output is correct
82 Correct 87 ms 194148 KB Output is correct
83 Correct 86 ms 193988 KB Output is correct
84 Correct 88 ms 194244 KB Output is correct
85 Correct 94 ms 194248 KB Output is correct
86 Correct 91 ms 194244 KB Output is correct
87 Correct 88 ms 194116 KB Output is correct
88 Correct 88 ms 194084 KB Output is correct
89 Correct 90 ms 194076 KB Output is correct
90 Correct 84 ms 194120 KB Output is correct
91 Correct 87 ms 194136 KB Output is correct
92 Correct 362 ms 220228 KB Output is correct
93 Correct 351 ms 220220 KB Output is correct
94 Correct 280 ms 219536 KB Output is correct
95 Correct 195 ms 219832 KB Output is correct
96 Correct 197 ms 219756 KB Output is correct
97 Correct 365 ms 222012 KB Output is correct
98 Correct 361 ms 222268 KB Output is correct
99 Correct 372 ms 220020 KB Output is correct
100 Correct 381 ms 220344 KB Output is correct
101 Correct 341 ms 220032 KB Output is correct
102 Correct 218 ms 218100 KB Output is correct
103 Correct 361 ms 221720 KB Output is correct
104 Correct 368 ms 221264 KB Output is correct
105 Correct 380 ms 221492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 79 ms 192324 KB Output is correct
2 Correct 84 ms 192404 KB Output is correct
3 Correct 79 ms 192324 KB Output is correct
4 Correct 78 ms 192328 KB Output is correct
5 Correct 88 ms 192392 KB Output is correct
6 Correct 87 ms 192428 KB Output is correct
7 Correct 79 ms 192368 KB Output is correct
8 Correct 84 ms 192540 KB Output is correct
9 Correct 81 ms 192396 KB Output is correct
10 Correct 79 ms 192324 KB Output is correct
11 Correct 83 ms 192388 KB Output is correct
12 Correct 80 ms 192388 KB Output is correct
13 Correct 79 ms 192324 KB Output is correct
14 Correct 84 ms 192440 KB Output is correct
15 Correct 93 ms 192324 KB Output is correct
16 Correct 79 ms 192420 KB Output is correct
17 Correct 80 ms 192424 KB Output is correct
18 Correct 81 ms 192416 KB Output is correct
19 Correct 80 ms 192372 KB Output is correct
20 Correct 88 ms 192332 KB Output is correct
21 Correct 98 ms 192324 KB Output is correct
22 Correct 79 ms 192436 KB Output is correct
23 Correct 79 ms 192324 KB Output is correct
24 Correct 80 ms 192360 KB Output is correct
25 Correct 82 ms 192480 KB Output is correct
26 Correct 80 ms 192452 KB Output is correct
27 Correct 80 ms 192452 KB Output is correct
28 Correct 78 ms 192404 KB Output is correct
29 Correct 79 ms 192348 KB Output is correct
30 Correct 85 ms 192340 KB Output is correct
31 Correct 80 ms 192448 KB Output is correct
32 Correct 78 ms 192424 KB Output is correct
33 Correct 79 ms 192324 KB Output is correct
34 Correct 81 ms 192452 KB Output is correct
35 Correct 79 ms 192328 KB Output is correct
36 Correct 91 ms 194372 KB Output is correct
37 Correct 89 ms 194284 KB Output is correct
38 Correct 88 ms 194124 KB Output is correct
39 Correct 92 ms 194084 KB Output is correct
40 Correct 91 ms 194076 KB Output is correct
41 Correct 89 ms 194212 KB Output is correct
42 Correct 95 ms 194264 KB Output is correct
43 Correct 98 ms 194236 KB Output is correct
44 Correct 87 ms 194276 KB Output is correct
45 Correct 90 ms 194084 KB Output is correct
46 Correct 88 ms 194228 KB Output is correct
47 Correct 96 ms 194144 KB Output is correct
48 Correct 88 ms 194168 KB Output is correct
49 Correct 91 ms 194116 KB Output is correct
50 Correct 81 ms 192428 KB Output is correct
51 Correct 82 ms 192372 KB Output is correct
52 Correct 82 ms 192440 KB Output is correct
53 Correct 80 ms 192400 KB Output is correct
54 Correct 80 ms 192452 KB Output is correct
55 Correct 81 ms 192372 KB Output is correct
56 Correct 80 ms 192452 KB Output is correct
57 Correct 80 ms 192456 KB Output is correct
58 Correct 80 ms 192412 KB Output is correct
59 Correct 79 ms 192488 KB Output is correct
60 Correct 80 ms 192480 KB Output is correct
61 Correct 81 ms 192404 KB Output is correct
62 Correct 84 ms 192392 KB Output is correct
63 Correct 80 ms 192380 KB Output is correct
64 Correct 84 ms 192528 KB Output is correct
65 Correct 86 ms 192560 KB Output is correct
66 Correct 80 ms 192624 KB Output is correct
67 Correct 81 ms 192708 KB Output is correct
68 Correct 81 ms 192580 KB Output is correct
69 Correct 88 ms 192584 KB Output is correct
70 Correct 81 ms 192580 KB Output is correct
71 Correct 79 ms 192524 KB Output is correct
72 Correct 81 ms 192536 KB Output is correct
73 Correct 80 ms 192580 KB Output is correct
74 Correct 81 ms 192624 KB Output is correct
75 Correct 85 ms 192672 KB Output is correct
76 Correct 79 ms 192564 KB Output is correct
77 Correct 79 ms 192612 KB Output is correct
78 Correct 88 ms 194204 KB Output is correct
79 Correct 90 ms 194144 KB Output is correct
80 Correct 93 ms 194152 KB Output is correct
81 Correct 89 ms 194100 KB Output is correct
82 Correct 87 ms 194148 KB Output is correct
83 Correct 86 ms 193988 KB Output is correct
84 Correct 88 ms 194244 KB Output is correct
85 Correct 94 ms 194248 KB Output is correct
86 Correct 91 ms 194244 KB Output is correct
87 Correct 88 ms 194116 KB Output is correct
88 Correct 88 ms 194084 KB Output is correct
89 Correct 90 ms 194076 KB Output is correct
90 Correct 84 ms 194120 KB Output is correct
91 Correct 87 ms 194136 KB Output is correct
92 Correct 362 ms 220228 KB Output is correct
93 Correct 351 ms 220220 KB Output is correct
94 Correct 280 ms 219536 KB Output is correct
95 Correct 195 ms 219832 KB Output is correct
96 Correct 197 ms 219756 KB Output is correct
97 Correct 365 ms 222012 KB Output is correct
98 Correct 361 ms 222268 KB Output is correct
99 Correct 372 ms 220020 KB Output is correct
100 Correct 381 ms 220344 KB Output is correct
101 Correct 341 ms 220032 KB Output is correct
102 Correct 218 ms 218100 KB Output is correct
103 Correct 361 ms 221720 KB Output is correct
104 Correct 368 ms 221264 KB Output is correct
105 Correct 380 ms 221492 KB Output is correct
106 Execution timed out 7034 ms 395492 KB Time limit exceeded
107 Halted 0 ms 0 KB -