Submission #330241

# Submission time Handle Problem Language Result Execution time Memory
330241 2020-11-24T08:33:53 Z cki86201 Mountains and Valleys (CCO20_day1problem3) C++17
21 / 25
4309 ms 205560 KB
#include <bits/stdc++.h>
using namespace std;

#define Fi first
#define Se second
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<(n);i++)
typedef tuple<int, int, int> t3;

const int ADD = 1<<19, INF = 1e9;
struct node {
	int pv, mv, cv, val;
	void init(int x, int d, int d2) {
		pv = d + x, mv = d - x, cv = d2;
		val = -INF;
	}
	node operator+(const node &R) const {
		node res;
		res.pv = max(pv, R.pv);
		res.mv = max(mv, R.mv);
		res.cv = max(cv, R.cv);
		res.val = max({val, R.val, pv + R.mv});
		return res;
	}
} T[1<<20];
void init(int x, int d, int d2) {
	T[ADD+x].init(x, d, d2);
	for(int r=(ADD+x)/2;r;r>>=1) {
		T[r] = T[r*2] + T[r*2+1];
	}
}
int lvt[100], rvt[100];
node read(int l, int r) {
	if(l > r) {
		node res; res.init(0, -INF, -INF);
		return res;
	}
	l += ADD, r += ADD;
	int lt = 0, rt = 0;
	while(l <= r) {
		if(l & 1) lvt[lt++] = l++;
		if(!(r & 1)) rvt[rt++] = r--;
		l >>= 1, r >>= 1;
	}
	while(rt) lvt[lt++] = rvt[--rt];
	node res = T[lvt[0]];
	for(int i=1;i<lt;i++) res = res + T[lvt[i]];
	return res;
}

int N, M;
vector <int> E[500050];
vector <t3> AE;

int dis[500050], pre[500050];
int far(int x) {
	memset(dis, -1, sizeof dis);
	vector <int> q;
	auto ins_q = [&](int x, int d, int p) { if(dis[x] == -1) q.pb(x), dis[x] = d, pre[x] = p; };
	ins_q(x, 0, -1);
	rep(i, szz(q)) {
		int t = q[i];
		for(int e : E[t]) ins_q(e, dis[t] + 1, t);
	}
	return q.back();
}

int fd[500050], dep[500050], up[500050][20], mxd[500050], dv[500050];
vector <pii> chd[500050], dvl[500050];

int get_l(vector <pii> &h, int d, int e = -1) {
	int res = 0, rc = 0;
	for(auto &[l, y] : h) if(y != e) {
		++rc;
		res += l;
		if(rc == d) return res;
	}
	return res;
}

int DL[500050][2];

void pdfs(int x) {
	for(int e : E[x]) if(fd[e] == -1) {
		fd[e] = fd[x];
		dep[e] = dep[x] + 1;
		up[e][0] = x;
		for(int i=1;i<20;i++) up[e][i] = up[ up[e][i-1] ][i-1];
		pdfs(e);
		mxd[x] = max(mxd[x], mxd[e] + 1);
		dv[x] = max(dv[x], dv[e]);
		chd[x].pb({mxd[e]+1, e});
		dvl[x].pb({dv[e], e});
	}
	sort(all(chd[x]), greater<>());
	sort(all(dvl[x]), greater<>());
	dv[x] = max(dv[x], get_l(chd[x], 2, -1));
}

int get_lca(int x, int y) {
	if(dep[x] < dep[y]) swap(x, y);
	rep(i, 20) if(1<<i & (dep[x] - dep[y])) x = up[x][i];
	for(int i=19;i>=0;i--) if(up[x][i] != up[y][i]) x = up[x][i], y = up[y][i];
	return x == y ? x : up[x][0];
}
int climb(int x, int d) {
	rep(i, 20) if(1<<i & d) x = up[x][i];
	return x;
}

void qdfs(int x, int u = 0, int h = 0, int fa = -1) {
	DL[x][1] = max(dv[x], h);
	for(int e : E[x]) if(fd[e] == fd[x] && e != fa) {
		int du = 0, dh = max({h, get_l(dvl[x], 1, e), get_l(chd[x], 2, e)});
		if(fa != -1) du = max(u, get_l(chd[x], 1, e)) + 1;
		DL[e][0] = max(du, mxd[e]);
		qdfs(e, du, dh, x);
	}
}

int main() {
	scanf("%d%d", &N, &M);
	rep(i, M) {
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		if(z == 1) {
			E[x].pb(y);
			E[y].pb(x);
		}
		else AE.pb({x, y, z});
	}
	int l = far(1);
	int r = far(l);
	int ans = 2 * (N - 1) - dis[r], lend = dis[r];
	vector <int> Dia;
	for(int t=r;t!=-1;t=pre[t]) Dia.pb(t);
	reverse(all(Dia));
	memset(fd, -1, sizeof fd);
	rep(i, szz(Dia)) fd[Dia[i]] = i;
	for(int e : Dia) pdfs(e);
	for(int e : Dia) DL[e][0] = -INF, qdfs(e);
	int m = szz(Dia);
	rep(i, m) init(i, mxd[Dia[i]], dv[Dia[i]]);
	for(auto [x, y, d] : AE) {
		if(fd[x] > fd[y]) swap(x, y);
		if(fd[x] == fd[y]) {
			int lca = get_lca(x, y);
			int c = dep[x] + dep[y] - 2 * dep[lca];
			ans = min(ans, 2 * N - 2 + d - c - lend);
		}
		else {
			int fx = fd[x], fy = fd[y], rx = Dia[fx], ry = Dia[fy];
			node n1 = read(0, fx-1), n2 = read(fx+1, fy-1), n3 = read(fy+1, m-1);
			int max_d2 = max({DL[x][1], DL[y][1], n1.pv, n2.cv, n3.mv+(m-1)});
			int cx = (dep[x] ? climb(x, dep[x]-1) : -1);
			int cy = (dep[y] ? climb(y, dep[y]-1) : -1);
			max_d2 = max({max_d2, fx + get_l(chd[rx], 1, cx), m-1-fy + get_l(chd[ry], 1, cy)});
			int c = fy - fx + dep[x] + dep[y];
			ans = min(ans, 2 * N - 2 + d - c - max_d2);

			int max_d1 = max(DL[x][0] + max(fy, m-1-fy) + dep[y], DL[y][0] + max(fx, m-1-fx) + dep[x]);
			max_d1 = max(max_d1, fx + dep[x] + (m-1-fy) + dep[y]);
			max_d1 = max(max_d1, fx + dep[x] + n2.mv + fy + dep[y]);
			max_d1 = max(max_d1, dep[x] + n2.pv - fx + (m-1-fy) + dep[y]);
			max_d1 = max(max_d1, n2.val + fy - fx + dep[x] + dep[y]);
			ans = min(ans, 2 * N - 4 + d - max_d1);
		}
	}
	printf("%d\n", ans);
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:127:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  127 |  scanf("%d%d", &N, &M);
      |  ~~~~~^~~~~~~~~~~~~~~~
Main.cpp:130:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  130 |   scanf("%d%d%d", &x, &y, &z);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 25 ms 39660 KB Output is correct
2 Correct 25 ms 39532 KB Output is correct
3 Correct 24 ms 39532 KB Output is correct
4 Correct 26 ms 39532 KB Output is correct
5 Correct 24 ms 39532 KB Output is correct
6 Correct 24 ms 39532 KB Output is correct
7 Correct 25 ms 39532 KB Output is correct
8 Correct 28 ms 39532 KB Output is correct
9 Correct 25 ms 39552 KB Output is correct
10 Correct 25 ms 39532 KB Output is correct
11 Correct 25 ms 39552 KB Output is correct
12 Correct 26 ms 39660 KB Output is correct
13 Correct 25 ms 39532 KB Output is correct
14 Correct 25 ms 39532 KB Output is correct
15 Correct 25 ms 39532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 39660 KB Output is correct
2 Correct 25 ms 39532 KB Output is correct
3 Correct 24 ms 39532 KB Output is correct
4 Correct 26 ms 39532 KB Output is correct
5 Correct 24 ms 39532 KB Output is correct
6 Correct 24 ms 39532 KB Output is correct
7 Correct 25 ms 39532 KB Output is correct
8 Correct 28 ms 39532 KB Output is correct
9 Correct 25 ms 39552 KB Output is correct
10 Correct 25 ms 39532 KB Output is correct
11 Correct 25 ms 39552 KB Output is correct
12 Correct 26 ms 39660 KB Output is correct
13 Correct 25 ms 39532 KB Output is correct
14 Correct 25 ms 39532 KB Output is correct
15 Correct 25 ms 39532 KB Output is correct
16 Correct 25 ms 39532 KB Output is correct
17 Correct 24 ms 39532 KB Output is correct
18 Correct 25 ms 39532 KB Output is correct
19 Correct 25 ms 39532 KB Output is correct
20 Correct 25 ms 39532 KB Output is correct
21 Correct 25 ms 39532 KB Output is correct
22 Correct 24 ms 39532 KB Output is correct
23 Correct 24 ms 39532 KB Output is correct
24 Correct 25 ms 39532 KB Output is correct
25 Correct 25 ms 39532 KB Output is correct
26 Correct 24 ms 39532 KB Output is correct
27 Correct 25 ms 39532 KB Output is correct
28 Correct 25 ms 39532 KB Output is correct
29 Correct 26 ms 39660 KB Output is correct
30 Correct 24 ms 39532 KB Output is correct
31 Correct 25 ms 39532 KB Output is correct
32 Correct 26 ms 39532 KB Output is correct
33 Correct 25 ms 39532 KB Output is correct
34 Correct 24 ms 39532 KB Output is correct
35 Correct 25 ms 39552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 40428 KB Output is correct
2 Correct 33 ms 40172 KB Output is correct
3 Correct 34 ms 40832 KB Output is correct
4 Correct 34 ms 40812 KB Output is correct
5 Correct 33 ms 40812 KB Output is correct
6 Correct 31 ms 40684 KB Output is correct
7 Correct 31 ms 40300 KB Output is correct
8 Correct 33 ms 40684 KB Output is correct
9 Correct 33 ms 40684 KB Output is correct
10 Correct 34 ms 40940 KB Output is correct
11 Correct 32 ms 40812 KB Output is correct
12 Correct 32 ms 40812 KB Output is correct
13 Correct 38 ms 40812 KB Output is correct
14 Correct 32 ms 40812 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 39660 KB Output is correct
2 Correct 25 ms 39532 KB Output is correct
3 Correct 24 ms 39532 KB Output is correct
4 Correct 26 ms 39532 KB Output is correct
5 Correct 24 ms 39532 KB Output is correct
6 Correct 24 ms 39532 KB Output is correct
7 Correct 25 ms 39532 KB Output is correct
8 Correct 28 ms 39532 KB Output is correct
9 Correct 25 ms 39552 KB Output is correct
10 Correct 25 ms 39532 KB Output is correct
11 Correct 25 ms 39552 KB Output is correct
12 Correct 26 ms 39660 KB Output is correct
13 Correct 25 ms 39532 KB Output is correct
14 Correct 25 ms 39532 KB Output is correct
15 Correct 25 ms 39532 KB Output is correct
16 Correct 25 ms 39532 KB Output is correct
17 Correct 24 ms 39532 KB Output is correct
18 Correct 25 ms 39532 KB Output is correct
19 Correct 25 ms 39532 KB Output is correct
20 Correct 25 ms 39532 KB Output is correct
21 Correct 25 ms 39532 KB Output is correct
22 Correct 24 ms 39532 KB Output is correct
23 Correct 24 ms 39532 KB Output is correct
24 Correct 25 ms 39532 KB Output is correct
25 Correct 25 ms 39532 KB Output is correct
26 Correct 24 ms 39532 KB Output is correct
27 Correct 25 ms 39532 KB Output is correct
28 Correct 25 ms 39532 KB Output is correct
29 Correct 26 ms 39660 KB Output is correct
30 Correct 24 ms 39532 KB Output is correct
31 Correct 25 ms 39532 KB Output is correct
32 Correct 26 ms 39532 KB Output is correct
33 Correct 25 ms 39532 KB Output is correct
34 Correct 24 ms 39532 KB Output is correct
35 Correct 25 ms 39552 KB Output is correct
36 Correct 26 ms 39532 KB Output is correct
37 Correct 25 ms 39660 KB Output is correct
38 Correct 26 ms 39660 KB Output is correct
39 Correct 30 ms 39660 KB Output is correct
40 Correct 25 ms 39660 KB Output is correct
41 Correct 25 ms 39660 KB Output is correct
42 Correct 25 ms 39532 KB Output is correct
43 Correct 25 ms 39660 KB Output is correct
44 Correct 25 ms 39660 KB Output is correct
45 Correct 25 ms 39660 KB Output is correct
46 Correct 25 ms 39660 KB Output is correct
47 Correct 26 ms 39660 KB Output is correct
48 Correct 25 ms 39660 KB Output is correct
49 Correct 24 ms 39660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 39660 KB Output is correct
2 Correct 25 ms 39532 KB Output is correct
3 Correct 24 ms 39532 KB Output is correct
4 Correct 26 ms 39532 KB Output is correct
5 Correct 24 ms 39532 KB Output is correct
6 Correct 24 ms 39532 KB Output is correct
7 Correct 25 ms 39532 KB Output is correct
8 Correct 28 ms 39532 KB Output is correct
9 Correct 25 ms 39552 KB Output is correct
10 Correct 25 ms 39532 KB Output is correct
11 Correct 25 ms 39552 KB Output is correct
12 Correct 26 ms 39660 KB Output is correct
13 Correct 25 ms 39532 KB Output is correct
14 Correct 25 ms 39532 KB Output is correct
15 Correct 25 ms 39532 KB Output is correct
16 Correct 25 ms 39532 KB Output is correct
17 Correct 24 ms 39532 KB Output is correct
18 Correct 25 ms 39532 KB Output is correct
19 Correct 25 ms 39532 KB Output is correct
20 Correct 25 ms 39532 KB Output is correct
21 Correct 25 ms 39532 KB Output is correct
22 Correct 24 ms 39532 KB Output is correct
23 Correct 24 ms 39532 KB Output is correct
24 Correct 25 ms 39532 KB Output is correct
25 Correct 25 ms 39532 KB Output is correct
26 Correct 24 ms 39532 KB Output is correct
27 Correct 25 ms 39532 KB Output is correct
28 Correct 25 ms 39532 KB Output is correct
29 Correct 26 ms 39660 KB Output is correct
30 Correct 24 ms 39532 KB Output is correct
31 Correct 25 ms 39532 KB Output is correct
32 Correct 26 ms 39532 KB Output is correct
33 Correct 25 ms 39532 KB Output is correct
34 Correct 24 ms 39532 KB Output is correct
35 Correct 25 ms 39552 KB Output is correct
36 Correct 26 ms 39532 KB Output is correct
37 Correct 25 ms 39660 KB Output is correct
38 Correct 26 ms 39660 KB Output is correct
39 Correct 30 ms 39660 KB Output is correct
40 Correct 25 ms 39660 KB Output is correct
41 Correct 25 ms 39660 KB Output is correct
42 Correct 25 ms 39532 KB Output is correct
43 Correct 25 ms 39660 KB Output is correct
44 Correct 25 ms 39660 KB Output is correct
45 Correct 25 ms 39660 KB Output is correct
46 Correct 25 ms 39660 KB Output is correct
47 Correct 26 ms 39660 KB Output is correct
48 Correct 25 ms 39660 KB Output is correct
49 Correct 24 ms 39660 KB Output is correct
50 Correct 29 ms 39660 KB Output is correct
51 Correct 25 ms 39660 KB Output is correct
52 Correct 25 ms 39660 KB Output is correct
53 Correct 30 ms 39660 KB Output is correct
54 Correct 26 ms 39660 KB Output is correct
55 Correct 26 ms 39660 KB Output is correct
56 Correct 26 ms 39660 KB Output is correct
57 Correct 28 ms 39660 KB Output is correct
58 Correct 25 ms 39660 KB Output is correct
59 Correct 26 ms 39660 KB Output is correct
60 Correct 26 ms 39788 KB Output is correct
61 Correct 26 ms 39788 KB Output is correct
62 Correct 25 ms 39660 KB Output is correct
63 Correct 25 ms 39660 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 39660 KB Output is correct
2 Correct 25 ms 39532 KB Output is correct
3 Correct 24 ms 39532 KB Output is correct
4 Correct 26 ms 39532 KB Output is correct
5 Correct 24 ms 39532 KB Output is correct
6 Correct 24 ms 39532 KB Output is correct
7 Correct 25 ms 39532 KB Output is correct
8 Correct 28 ms 39532 KB Output is correct
9 Correct 25 ms 39552 KB Output is correct
10 Correct 25 ms 39532 KB Output is correct
11 Correct 25 ms 39552 KB Output is correct
12 Correct 26 ms 39660 KB Output is correct
13 Correct 25 ms 39532 KB Output is correct
14 Correct 25 ms 39532 KB Output is correct
15 Correct 25 ms 39532 KB Output is correct
16 Correct 25 ms 39532 KB Output is correct
17 Correct 24 ms 39532 KB Output is correct
18 Correct 25 ms 39532 KB Output is correct
19 Correct 25 ms 39532 KB Output is correct
20 Correct 25 ms 39532 KB Output is correct
21 Correct 25 ms 39532 KB Output is correct
22 Correct 24 ms 39532 KB Output is correct
23 Correct 24 ms 39532 KB Output is correct
24 Correct 25 ms 39532 KB Output is correct
25 Correct 25 ms 39532 KB Output is correct
26 Correct 24 ms 39532 KB Output is correct
27 Correct 25 ms 39532 KB Output is correct
28 Correct 25 ms 39532 KB Output is correct
29 Correct 26 ms 39660 KB Output is correct
30 Correct 24 ms 39532 KB Output is correct
31 Correct 25 ms 39532 KB Output is correct
32 Correct 26 ms 39532 KB Output is correct
33 Correct 25 ms 39532 KB Output is correct
34 Correct 24 ms 39532 KB Output is correct
35 Correct 25 ms 39552 KB Output is correct
36 Correct 37 ms 40428 KB Output is correct
37 Correct 33 ms 40172 KB Output is correct
38 Correct 34 ms 40832 KB Output is correct
39 Correct 34 ms 40812 KB Output is correct
40 Correct 33 ms 40812 KB Output is correct
41 Correct 31 ms 40684 KB Output is correct
42 Correct 31 ms 40300 KB Output is correct
43 Correct 33 ms 40684 KB Output is correct
44 Correct 33 ms 40684 KB Output is correct
45 Correct 34 ms 40940 KB Output is correct
46 Correct 32 ms 40812 KB Output is correct
47 Correct 32 ms 40812 KB Output is correct
48 Correct 38 ms 40812 KB Output is correct
49 Correct 32 ms 40812 KB Output is correct
50 Correct 26 ms 39532 KB Output is correct
51 Correct 25 ms 39660 KB Output is correct
52 Correct 26 ms 39660 KB Output is correct
53 Correct 30 ms 39660 KB Output is correct
54 Correct 25 ms 39660 KB Output is correct
55 Correct 25 ms 39660 KB Output is correct
56 Correct 25 ms 39532 KB Output is correct
57 Correct 25 ms 39660 KB Output is correct
58 Correct 25 ms 39660 KB Output is correct
59 Correct 25 ms 39660 KB Output is correct
60 Correct 25 ms 39660 KB Output is correct
61 Correct 26 ms 39660 KB Output is correct
62 Correct 25 ms 39660 KB Output is correct
63 Correct 24 ms 39660 KB Output is correct
64 Correct 29 ms 39660 KB Output is correct
65 Correct 25 ms 39660 KB Output is correct
66 Correct 25 ms 39660 KB Output is correct
67 Correct 30 ms 39660 KB Output is correct
68 Correct 26 ms 39660 KB Output is correct
69 Correct 26 ms 39660 KB Output is correct
70 Correct 26 ms 39660 KB Output is correct
71 Correct 28 ms 39660 KB Output is correct
72 Correct 25 ms 39660 KB Output is correct
73 Correct 26 ms 39660 KB Output is correct
74 Correct 26 ms 39788 KB Output is correct
75 Correct 26 ms 39788 KB Output is correct
76 Correct 25 ms 39660 KB Output is correct
77 Correct 25 ms 39660 KB Output is correct
78 Correct 32 ms 40172 KB Output is correct
79 Correct 32 ms 40172 KB Output is correct
80 Correct 34 ms 40812 KB Output is correct
81 Correct 33 ms 40832 KB Output is correct
82 Correct 32 ms 40812 KB Output is correct
83 Correct 34 ms 40960 KB Output is correct
84 Correct 36 ms 40300 KB Output is correct
85 Correct 33 ms 40684 KB Output is correct
86 Correct 33 ms 40684 KB Output is correct
87 Correct 34 ms 40812 KB Output is correct
88 Correct 33 ms 40812 KB Output is correct
89 Correct 33 ms 40812 KB Output is correct
90 Correct 30 ms 40832 KB Output is correct
91 Correct 30 ms 40684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 39660 KB Output is correct
2 Correct 25 ms 39532 KB Output is correct
3 Correct 24 ms 39532 KB Output is correct
4 Correct 26 ms 39532 KB Output is correct
5 Correct 24 ms 39532 KB Output is correct
6 Correct 24 ms 39532 KB Output is correct
7 Correct 25 ms 39532 KB Output is correct
8 Correct 28 ms 39532 KB Output is correct
9 Correct 25 ms 39552 KB Output is correct
10 Correct 25 ms 39532 KB Output is correct
11 Correct 25 ms 39552 KB Output is correct
12 Correct 26 ms 39660 KB Output is correct
13 Correct 25 ms 39532 KB Output is correct
14 Correct 25 ms 39532 KB Output is correct
15 Correct 25 ms 39532 KB Output is correct
16 Correct 25 ms 39532 KB Output is correct
17 Correct 24 ms 39532 KB Output is correct
18 Correct 25 ms 39532 KB Output is correct
19 Correct 25 ms 39532 KB Output is correct
20 Correct 25 ms 39532 KB Output is correct
21 Correct 25 ms 39532 KB Output is correct
22 Correct 24 ms 39532 KB Output is correct
23 Correct 24 ms 39532 KB Output is correct
24 Correct 25 ms 39532 KB Output is correct
25 Correct 25 ms 39532 KB Output is correct
26 Correct 24 ms 39532 KB Output is correct
27 Correct 25 ms 39532 KB Output is correct
28 Correct 25 ms 39532 KB Output is correct
29 Correct 26 ms 39660 KB Output is correct
30 Correct 24 ms 39532 KB Output is correct
31 Correct 25 ms 39532 KB Output is correct
32 Correct 26 ms 39532 KB Output is correct
33 Correct 25 ms 39532 KB Output is correct
34 Correct 24 ms 39532 KB Output is correct
35 Correct 25 ms 39552 KB Output is correct
36 Correct 37 ms 40428 KB Output is correct
37 Correct 33 ms 40172 KB Output is correct
38 Correct 34 ms 40832 KB Output is correct
39 Correct 34 ms 40812 KB Output is correct
40 Correct 33 ms 40812 KB Output is correct
41 Correct 31 ms 40684 KB Output is correct
42 Correct 31 ms 40300 KB Output is correct
43 Correct 33 ms 40684 KB Output is correct
44 Correct 33 ms 40684 KB Output is correct
45 Correct 34 ms 40940 KB Output is correct
46 Correct 32 ms 40812 KB Output is correct
47 Correct 32 ms 40812 KB Output is correct
48 Correct 38 ms 40812 KB Output is correct
49 Correct 32 ms 40812 KB Output is correct
50 Correct 26 ms 39532 KB Output is correct
51 Correct 25 ms 39660 KB Output is correct
52 Correct 26 ms 39660 KB Output is correct
53 Correct 30 ms 39660 KB Output is correct
54 Correct 25 ms 39660 KB Output is correct
55 Correct 25 ms 39660 KB Output is correct
56 Correct 25 ms 39532 KB Output is correct
57 Correct 25 ms 39660 KB Output is correct
58 Correct 25 ms 39660 KB Output is correct
59 Correct 25 ms 39660 KB Output is correct
60 Correct 25 ms 39660 KB Output is correct
61 Correct 26 ms 39660 KB Output is correct
62 Correct 25 ms 39660 KB Output is correct
63 Correct 24 ms 39660 KB Output is correct
64 Correct 29 ms 39660 KB Output is correct
65 Correct 25 ms 39660 KB Output is correct
66 Correct 25 ms 39660 KB Output is correct
67 Correct 30 ms 39660 KB Output is correct
68 Correct 26 ms 39660 KB Output is correct
69 Correct 26 ms 39660 KB Output is correct
70 Correct 26 ms 39660 KB Output is correct
71 Correct 28 ms 39660 KB Output is correct
72 Correct 25 ms 39660 KB Output is correct
73 Correct 26 ms 39660 KB Output is correct
74 Correct 26 ms 39788 KB Output is correct
75 Correct 26 ms 39788 KB Output is correct
76 Correct 25 ms 39660 KB Output is correct
77 Correct 25 ms 39660 KB Output is correct
78 Correct 32 ms 40172 KB Output is correct
79 Correct 32 ms 40172 KB Output is correct
80 Correct 34 ms 40812 KB Output is correct
81 Correct 33 ms 40832 KB Output is correct
82 Correct 32 ms 40812 KB Output is correct
83 Correct 34 ms 40960 KB Output is correct
84 Correct 36 ms 40300 KB Output is correct
85 Correct 33 ms 40684 KB Output is correct
86 Correct 33 ms 40684 KB Output is correct
87 Correct 34 ms 40812 KB Output is correct
88 Correct 33 ms 40812 KB Output is correct
89 Correct 33 ms 40812 KB Output is correct
90 Correct 30 ms 40832 KB Output is correct
91 Correct 30 ms 40684 KB Output is correct
92 Correct 253 ms 60212 KB Output is correct
93 Correct 281 ms 58912 KB Output is correct
94 Correct 221 ms 60192 KB Output is correct
95 Correct 175 ms 58092 KB Output is correct
96 Correct 173 ms 58228 KB Output is correct
97 Correct 216 ms 50084 KB Output is correct
98 Correct 250 ms 50080 KB Output is correct
99 Correct 253 ms 60576 KB Output is correct
100 Correct 291 ms 60264 KB Output is correct
101 Correct 262 ms 59808 KB Output is correct
102 Correct 164 ms 56352 KB Output is correct
103 Correct 216 ms 50212 KB Output is correct
104 Correct 321 ms 57384 KB Output is correct
105 Correct 242 ms 56872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 39660 KB Output is correct
2 Correct 25 ms 39532 KB Output is correct
3 Correct 24 ms 39532 KB Output is correct
4 Correct 26 ms 39532 KB Output is correct
5 Correct 24 ms 39532 KB Output is correct
6 Correct 24 ms 39532 KB Output is correct
7 Correct 25 ms 39532 KB Output is correct
8 Correct 28 ms 39532 KB Output is correct
9 Correct 25 ms 39552 KB Output is correct
10 Correct 25 ms 39532 KB Output is correct
11 Correct 25 ms 39552 KB Output is correct
12 Correct 26 ms 39660 KB Output is correct
13 Correct 25 ms 39532 KB Output is correct
14 Correct 25 ms 39532 KB Output is correct
15 Correct 25 ms 39532 KB Output is correct
16 Correct 25 ms 39532 KB Output is correct
17 Correct 24 ms 39532 KB Output is correct
18 Correct 25 ms 39532 KB Output is correct
19 Correct 25 ms 39532 KB Output is correct
20 Correct 25 ms 39532 KB Output is correct
21 Correct 25 ms 39532 KB Output is correct
22 Correct 24 ms 39532 KB Output is correct
23 Correct 24 ms 39532 KB Output is correct
24 Correct 25 ms 39532 KB Output is correct
25 Correct 25 ms 39532 KB Output is correct
26 Correct 24 ms 39532 KB Output is correct
27 Correct 25 ms 39532 KB Output is correct
28 Correct 25 ms 39532 KB Output is correct
29 Correct 26 ms 39660 KB Output is correct
30 Correct 24 ms 39532 KB Output is correct
31 Correct 25 ms 39532 KB Output is correct
32 Correct 26 ms 39532 KB Output is correct
33 Correct 25 ms 39532 KB Output is correct
34 Correct 24 ms 39532 KB Output is correct
35 Correct 25 ms 39552 KB Output is correct
36 Correct 37 ms 40428 KB Output is correct
37 Correct 33 ms 40172 KB Output is correct
38 Correct 34 ms 40832 KB Output is correct
39 Correct 34 ms 40812 KB Output is correct
40 Correct 33 ms 40812 KB Output is correct
41 Correct 31 ms 40684 KB Output is correct
42 Correct 31 ms 40300 KB Output is correct
43 Correct 33 ms 40684 KB Output is correct
44 Correct 33 ms 40684 KB Output is correct
45 Correct 34 ms 40940 KB Output is correct
46 Correct 32 ms 40812 KB Output is correct
47 Correct 32 ms 40812 KB Output is correct
48 Correct 38 ms 40812 KB Output is correct
49 Correct 32 ms 40812 KB Output is correct
50 Correct 26 ms 39532 KB Output is correct
51 Correct 25 ms 39660 KB Output is correct
52 Correct 26 ms 39660 KB Output is correct
53 Correct 30 ms 39660 KB Output is correct
54 Correct 25 ms 39660 KB Output is correct
55 Correct 25 ms 39660 KB Output is correct
56 Correct 25 ms 39532 KB Output is correct
57 Correct 25 ms 39660 KB Output is correct
58 Correct 25 ms 39660 KB Output is correct
59 Correct 25 ms 39660 KB Output is correct
60 Correct 25 ms 39660 KB Output is correct
61 Correct 26 ms 39660 KB Output is correct
62 Correct 25 ms 39660 KB Output is correct
63 Correct 24 ms 39660 KB Output is correct
64 Correct 29 ms 39660 KB Output is correct
65 Correct 25 ms 39660 KB Output is correct
66 Correct 25 ms 39660 KB Output is correct
67 Correct 30 ms 39660 KB Output is correct
68 Correct 26 ms 39660 KB Output is correct
69 Correct 26 ms 39660 KB Output is correct
70 Correct 26 ms 39660 KB Output is correct
71 Correct 28 ms 39660 KB Output is correct
72 Correct 25 ms 39660 KB Output is correct
73 Correct 26 ms 39660 KB Output is correct
74 Correct 26 ms 39788 KB Output is correct
75 Correct 26 ms 39788 KB Output is correct
76 Correct 25 ms 39660 KB Output is correct
77 Correct 25 ms 39660 KB Output is correct
78 Correct 32 ms 40172 KB Output is correct
79 Correct 32 ms 40172 KB Output is correct
80 Correct 34 ms 40812 KB Output is correct
81 Correct 33 ms 40832 KB Output is correct
82 Correct 32 ms 40812 KB Output is correct
83 Correct 34 ms 40960 KB Output is correct
84 Correct 36 ms 40300 KB Output is correct
85 Correct 33 ms 40684 KB Output is correct
86 Correct 33 ms 40684 KB Output is correct
87 Correct 34 ms 40812 KB Output is correct
88 Correct 33 ms 40812 KB Output is correct
89 Correct 33 ms 40812 KB Output is correct
90 Correct 30 ms 40832 KB Output is correct
91 Correct 30 ms 40684 KB Output is correct
92 Correct 253 ms 60212 KB Output is correct
93 Correct 281 ms 58912 KB Output is correct
94 Correct 221 ms 60192 KB Output is correct
95 Correct 175 ms 58092 KB Output is correct
96 Correct 173 ms 58228 KB Output is correct
97 Correct 216 ms 50084 KB Output is correct
98 Correct 250 ms 50080 KB Output is correct
99 Correct 253 ms 60576 KB Output is correct
100 Correct 291 ms 60264 KB Output is correct
101 Correct 262 ms 59808 KB Output is correct
102 Correct 164 ms 56352 KB Output is correct
103 Correct 216 ms 50212 KB Output is correct
104 Correct 321 ms 57384 KB Output is correct
105 Correct 242 ms 56872 KB Output is correct
106 Correct 3455 ms 138252 KB Output is correct
107 Correct 3616 ms 138368 KB Output is correct
108 Correct 4126 ms 205560 KB Output is correct
109 Correct 4309 ms 201836 KB Output is correct
110 Incorrect 4213 ms 200328 KB Output isn't correct
111 Halted 0 ms 0 KB -