Submission #501271

# Submission time Handle Problem Language Result Execution time Memory
501271 2022-01-02T17:29:43 Z rainboy Wells (CEOI21_wells) C
50 / 100
10000 ms 26068 KB
#include <stdio.h>

#define N	500000
#define INF	0x3f3f3f3f3f3f3f3fLL
#define MD	1000000007
#define H_	19	/* H_ = ceil(log2(N * 2)) */
#define N_	(1 << H_)

long long min(long long a, long long b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }

int mem[(N - 1) * 2], *ptr = mem, *ej[N], eo[N], n, k;

int ll[N], jj[N], ta[N], tb[N], kk[N + 1], qu[N * 2];

void dfs1(int p, int i, int d) {
	int o;

	kk[d + 1]++;
	ll[i] = 0, jj[i] = -1;
	for (o = eo[i]; o--; ) {
		int j = ej[i][o];

		if (j != p) {
			dfs1(i, j, d + 1);
			if (ll[i] < ll[j])
				ll[i] = ll[j], jj[i] = j;
		}
	}
	ll[i]++;
}

void dfs2(int p, int i, int d) {
	static int time;
	int o;

	qu[ta[i] = time++] = i, tb[i] = kk[d]++;
	if (jj[i] != -1)
		dfs2(i, jj[i], d + 1);
	else
		time++;
	for (o = eo[i]; o--; ) {
		int j = ej[i][o];

		if (j != p && j != jj[i])
			dfs2(i, j, d + 1);
	}
}

int cnt[N * 2]; long long xx[N + 1];

void get_range(int a, int *l, int *r) {
	*l = tb[qu[a]], *r = *l + cnt[a];
}

void dfs3(int p, int i) {
	int o, d, l1, r1, l2, r2;
	long long c;

	for (o = eo[i]; o--; ) {
		int j = ej[i][o];

		if (j != p)
			dfs3(i, j);
	}
	if (k <= ll[i]) {
		get_range(ta[i] + k - 1, &l1, &r1);
		xx[l1]++, xx[r1]--;
		if (p != -1)
			xx[tb[p]] -= r1 - l1, xx[tb[p] + 1] += r1 - l1;
	}
	cnt[ta[i]]++;
	for (o = eo[i]; o--; ) {
		int j = ej[i][o];

		if (j != p && j != jj[i]) {
			for (d = 1; d <= ll[j] && d < k; d++)
				if (k - d <= ll[i]) {
					get_range(ta[i] + k - d - 1, &l1, &r1), get_range(ta[j] + d - 1, &l2, &r2);
					c = (long long) (r1 - l1) * (r2 - l2);
					xx[l1] += r2 - l2, xx[r1] -= r2 - l2;
					xx[l2] += r1 - l1, xx[r2] -= r1 - l1;
					xx[tb[i]] -= c, xx[tb[i] + 1] += c;
					if (p != -1)
						xx[tb[p]] -= c, xx[tb[p] + 1] += c;
				}
			for (d = 1; d <= ll[j]; d++)
				cnt[ta[i] + d] += cnt[ta[j] + d - 1];
		}
	}
}

long long ww[N];

void dfs4(int p, int i) {
	int o;

	ww[i] = xx[tb[i]];
	for (o = eo[i]; o--; ) {
		int j = ej[i][o];

		if (j != p) {
			dfs4(i, j);
			ww[i] += ww[j];
		}
	}
}

int h_, n_;
long long stu[N_ * 2], lzu[N_]; int stv[N_ * 2], lzv[N_];

void put(int i, long long u, long long v) {
	if (stu[i] != INF && u != INF)
		stu[i] += u, stv[i] = (long long) stv[i] * v % MD;
	else
		stu[i] = INF, stv[i] = 0;
	if (i < n_) {
		if (lzu[i] != INF && u != INF)
			lzu[i] += u, lzv[i] = (long long) lzv[i] * v % MD;
		else
			lzu[i] = INF, lzv[i] = 0;
	}
}

void pus(int i) {
	if (lzu[i] != 0 || lzv[i] != 1)
		put(i << 1 | 0, lzu[i], lzv[i]), put(i << 1 | 1, lzu[i], lzv[i]), lzu[i] = 0, lzv[i] = 1;
}

void pul(int i) {
	if (lzu[i] == 0 && lzv[i] == 1) {
		int l = i << 1, r = l | 1;

		if (stu[l] < stu[r])
			stu[i] = stu[l], stv[i] = stv[l];
		else if (stu[l] > stu[r])
			stu[i] = stu[r], stv[i] = stv[r];
		else
			stu[i] = stu[l], stv[i] = (stv[l] + stv[r]) % MD;
	}
}

void push(int i) {
	int h;

	for (h = h_; h > 0; h--)
		pus(i >> h);
}

void pull(int i) {
	while (i > 1)
		pul(i >>= 1);
}

void upd(int i, long long u, int v) {
	push(i += n_);
	stu[i] = u, stv[i] = v;
	pull(i);
}

void update(int l, int r, long long u, int v) {
	if (l <= r) {
		int l_ = l += n_, r_ = r += n_;

		push(l_), push(r_);
		for ( ; l <= r; l >>= 1, r >>= 1) {
			if ((l & 1) == 1)
				put(l++, u, v);
			if ((r & 1) == 0)
				put(r--, u, v);
		}
		pull(l_), pull(r_);
	}
}

void query(int l, int r, long long *u_, int *v_) {
	long long u = INF, v = 0;

	if (l <= r) {
		push(l += n_), push(r += n_);
		for ( ; l <= r; l >>= 1, r >>= 1) {
			if ((l & 1) == 1) {
				if (u > stu[l])
					u = stu[l], v = 0;
				if (u == stu[l])
					v = (v + stv[l]) % MD;
				l++;
			}
			if ((r & 1) == 0) {
				if (u > stu[r])
					u = stu[r], v = 0;
				if (u == stu[r])
					v = (v + stv[r]) % MD;
				r--;
			}
		}
	}
	*u_ = u, *v_ = v;
}

void process(int i, int j, int d) {
	long long u1, ui, uj, u;
	int v1, vi, vj, v;

	u1 = INF, v1 = 0;
	query(ta[i] + d, ta[i] + d, &ui, &vi);
	query(ta[j], ta[j] + min(ll[j], min(k - d - 1, d - 2)), &uj, &vj);
	u = ui + uj;
	v = (long long) vi * vj % MD;
	if (u1 > u)
		u1 = u, v1 = 0;
	if (u1 == u)
		v1 = (v1 + v) % MD;
	if (d - 1 <= ll[j]) {
		query(ta[j] + d - 1, ta[j] + d - 1, &uj, &vj);
		query(ta[i] + 1, ta[i] + min(k - d, d), &ui, &vi);
		u = ui + uj;
		v = (long long) vi * vj % MD;
		if (u1 > u)
			u1 = u, v1 = 0;
		if (u1 == u)
			v1 = (v1 + v) % MD;
	}
	upd(ta[i] + d, u1, v1);
}

void dfs5(int p, int i) {
	int o, j, d;
	long long u;
	int v;

	upd(ta[i] + 0, ww[i], 1);
	if (jj[i] == -1)
		upd(ta[i] + 1, 0, 1);
	else {
		for (o = eo[i]; o--; ) {
			j = ej[i][o];
			if (j != p)
				dfs5(i, j);
		}
		j = jj[i];
		query(ta[j], ta[j] + ll[j], &u, &v);
		update(ta[i] + 0, ta[i] + 0, u, v);
		if (ll[i] >= k)
			upd(ta[i] + k, INF, 0);
		for (o = eo[i]; o--; ) {
			j = ej[i][o];
			if (j != p && j != jj[i]) {
				int lower, upper;

				query(ta[j], ta[j] + ll[j], &u, &v);
				update(ta[i] + 0, ta[i] + 0, u, v);
				lower = ll[j] + 2, upper = min(ll[i], k - 1 - ll[j]);
				if (lower > upper)
					for (d = min(ll[i], k); d > 0; d--)
						process(i, j, d);
				else {
					for (d = min(ll[i], k); d > upper; d--)
						process(i, j, d);
					query(ta[j], ta[j] + ll[j], &u, &v);
					update(ta[i] + lower, ta[i] + upper, u, v);
					for (d = lower - 1; d > 0; d--)
						process(i, j, d);
				}
			}
		}
		for (d = 0; d <= ll[i]; d++)
			query(ta[i] + d, ta[i] + d, &u, &v);
	}
}

int main() {
	static int ii_[N - 1], jj_[N - 1];
	int h, i, j, d, v;
	long long w, u;

	scanf("%d%d", &n, &k);
	for (h = 0; h < n - 1; h++) {
		scanf("%d%d", &i, &j), i--, j--;
		ii_[h] = i, jj_[h] = j;
		eo[i]++, eo[j]++;
	}
	for (i = 0; i < n; i++) {
		ej[i] = ptr, ptr += eo[i];
		eo[i] = 0;
	}
	for (h = 0; h < n - 1; h++) {
		i = ii_[h], j = jj_[h];
		ej[i][eo[i]++] = j, ej[j][eo[j]++] = i;
	}
	dfs1(-1, 0, 0);
	for (d = 1; d <= n; d++)
		kk[d] += kk[d - 1];
	dfs2(-1, 0, 0);
	dfs3(-1, 0);
	for (i = 1; i <= n; i++)
		xx[i] += xx[i - 1];
	dfs4(-1, 0);
	w = 0;
	for (i = 0; i < n; i++)
		w += ww[i];
	w /= k;
	h_ = 0;
	while (1 << h_ < n * 2)
		h_++;
	n_ = 1 << h_;
	for (i = 0; i < n_ * 2; i++)
		lzv[i] = 1;
	dfs5(-1, 0);
	query(ta[0], ta[0] + ll[0], &u, &v);
	if (u == w)
		printf("YES\n%d\n", v);
	else
		printf("NO\n0\n");
	return 0;
}

Compilation message

wells.c: In function 'main':
wells.c:277:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
  277 |  scanf("%d%d", &n, &k);
      |  ^~~~~~~~~~~~~~~~~~~~~
wells.c:279:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
  279 |   scanf("%d%d", &i, &j), i--, j--;
      |   ^~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 412 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 416 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 440 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 324 KB Output is correct
31 Correct 1 ms 412 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 424 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 460 KB Output is correct
38 Correct 1 ms 460 KB Output is correct
39 Correct 1 ms 412 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 1 ms 460 KB Output is correct
44 Correct 1 ms 332 KB Output is correct
45 Correct 2 ms 332 KB Output is correct
46 Correct 1 ms 460 KB Output is correct
47 Correct 1 ms 416 KB Output is correct
48 Correct 1 ms 416 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 1 ms 408 KB Output is correct
51 Correct 1 ms 332 KB Output is correct
52 Correct 1 ms 332 KB Output is correct
53 Correct 1 ms 340 KB Output is correct
54 Correct 1 ms 412 KB Output is correct
55 Correct 1 ms 332 KB Output is correct
56 Correct 1 ms 332 KB Output is correct
57 Correct 1 ms 332 KB Output is correct
58 Correct 1 ms 408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 412 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 416 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 440 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 324 KB Output is correct
31 Correct 1 ms 412 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 424 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 460 KB Output is correct
38 Correct 1 ms 460 KB Output is correct
39 Correct 1 ms 412 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 1 ms 460 KB Output is correct
44 Correct 1 ms 332 KB Output is correct
45 Correct 2 ms 332 KB Output is correct
46 Correct 1 ms 460 KB Output is correct
47 Correct 1 ms 416 KB Output is correct
48 Correct 1 ms 416 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 1 ms 408 KB Output is correct
51 Correct 1 ms 332 KB Output is correct
52 Correct 1 ms 332 KB Output is correct
53 Correct 1 ms 340 KB Output is correct
54 Correct 1 ms 412 KB Output is correct
55 Correct 1 ms 332 KB Output is correct
56 Correct 1 ms 332 KB Output is correct
57 Correct 1 ms 332 KB Output is correct
58 Correct 1 ms 408 KB Output is correct
59 Correct 0 ms 276 KB Output is correct
60 Correct 114 ms 980 KB Output is correct
61 Correct 47 ms 844 KB Output is correct
62 Correct 65 ms 1068 KB Output is correct
63 Correct 272 ms 2008 KB Output is correct
64 Correct 2903 ms 2852 KB Output is correct
65 Correct 72 ms 1816 KB Output is correct
66 Correct 35 ms 1968 KB Output is correct
67 Correct 2976 ms 2936 KB Output is correct
68 Correct 99 ms 1220 KB Output is correct
69 Correct 9 ms 984 KB Output is correct
70 Correct 153 ms 2120 KB Output is correct
71 Correct 55 ms 1188 KB Output is correct
72 Correct 58 ms 1280 KB Output is correct
73 Correct 187 ms 1296 KB Output is correct
74 Correct 1016 ms 2284 KB Output is correct
75 Correct 85 ms 2140 KB Output is correct
76 Correct 171 ms 2200 KB Output is correct
77 Correct 12 ms 1148 KB Output is correct
78 Correct 23 ms 1228 KB Output is correct
79 Correct 12 ms 1188 KB Output is correct
80 Correct 552 ms 1876 KB Output is correct
81 Correct 717 ms 1960 KB Output is correct
82 Correct 86 ms 2088 KB Output is correct
83 Correct 322 ms 2512 KB Output is correct
84 Correct 75 ms 2108 KB Output is correct
85 Correct 1304 ms 2500 KB Output is correct
86 Correct 60 ms 2072 KB Output is correct
87 Correct 730 ms 2092 KB Output is correct
88 Correct 710 ms 2048 KB Output is correct
89 Correct 217 ms 1936 KB Output is correct
90 Correct 70 ms 1092 KB Output is correct
91 Correct 181 ms 2096 KB Output is correct
92 Correct 807 ms 2364 KB Output is correct
93 Correct 479 ms 2532 KB Output is correct
94 Correct 26 ms 1860 KB Output is correct
95 Correct 62 ms 1872 KB Output is correct
96 Correct 47 ms 1240 KB Output is correct
97 Correct 222 ms 1368 KB Output is correct
98 Correct 333 ms 1556 KB Output is correct
99 Correct 74 ms 1596 KB Output is correct
100 Correct 312 ms 2260 KB Output is correct
101 Correct 65 ms 1996 KB Output is correct
102 Correct 404 ms 2348 KB Output is correct
103 Correct 205 ms 2284 KB Output is correct
104 Correct 433 ms 2084 KB Output is correct
105 Correct 882 ms 2376 KB Output is correct
106 Correct 47 ms 1724 KB Output is correct
107 Correct 1254 ms 2324 KB Output is correct
108 Correct 214 ms 1844 KB Output is correct
109 Correct 226 ms 1880 KB Output is correct
110 Correct 311 ms 2344 KB Output is correct
111 Correct 372 ms 2160 KB Output is correct
112 Correct 717 ms 2408 KB Output is correct
113 Correct 178 ms 2104 KB Output is correct
114 Correct 379 ms 2348 KB Output is correct
115 Correct 69 ms 2080 KB Output is correct
116 Correct 759 ms 2332 KB Output is correct
117 Correct 145 ms 2152 KB Output is correct
118 Correct 1012 ms 2612 KB Output is correct
119 Correct 179 ms 2080 KB Output is correct
120 Correct 667 ms 2492 KB Output is correct
121 Correct 392 ms 2376 KB Output is correct
122 Correct 397 ms 2344 KB Output is correct
123 Correct 170 ms 2144 KB Output is correct
124 Correct 564 ms 2448 KB Output is correct
125 Correct 269 ms 2200 KB Output is correct
126 Correct 40 ms 1988 KB Output is correct
127 Correct 866 ms 2440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 412 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 416 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 440 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 324 KB Output is correct
31 Correct 1 ms 412 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 424 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 460 KB Output is correct
38 Correct 1 ms 460 KB Output is correct
39 Correct 1 ms 412 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 1 ms 460 KB Output is correct
44 Correct 1 ms 332 KB Output is correct
45 Correct 2 ms 332 KB Output is correct
46 Correct 1 ms 460 KB Output is correct
47 Correct 1 ms 416 KB Output is correct
48 Correct 1 ms 416 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 1 ms 408 KB Output is correct
51 Correct 1 ms 332 KB Output is correct
52 Correct 1 ms 332 KB Output is correct
53 Correct 1 ms 340 KB Output is correct
54 Correct 1 ms 412 KB Output is correct
55 Correct 1 ms 332 KB Output is correct
56 Correct 1 ms 332 KB Output is correct
57 Correct 1 ms 332 KB Output is correct
58 Correct 1 ms 408 KB Output is correct
59 Correct 0 ms 276 KB Output is correct
60 Correct 114 ms 980 KB Output is correct
61 Correct 47 ms 844 KB Output is correct
62 Correct 65 ms 1068 KB Output is correct
63 Correct 272 ms 2008 KB Output is correct
64 Correct 2903 ms 2852 KB Output is correct
65 Correct 72 ms 1816 KB Output is correct
66 Correct 35 ms 1968 KB Output is correct
67 Correct 2976 ms 2936 KB Output is correct
68 Correct 99 ms 1220 KB Output is correct
69 Correct 9 ms 984 KB Output is correct
70 Correct 153 ms 2120 KB Output is correct
71 Correct 55 ms 1188 KB Output is correct
72 Correct 58 ms 1280 KB Output is correct
73 Correct 187 ms 1296 KB Output is correct
74 Correct 1016 ms 2284 KB Output is correct
75 Correct 85 ms 2140 KB Output is correct
76 Correct 171 ms 2200 KB Output is correct
77 Correct 12 ms 1148 KB Output is correct
78 Correct 23 ms 1228 KB Output is correct
79 Correct 12 ms 1188 KB Output is correct
80 Correct 552 ms 1876 KB Output is correct
81 Correct 717 ms 1960 KB Output is correct
82 Correct 86 ms 2088 KB Output is correct
83 Correct 322 ms 2512 KB Output is correct
84 Correct 75 ms 2108 KB Output is correct
85 Correct 1304 ms 2500 KB Output is correct
86 Correct 60 ms 2072 KB Output is correct
87 Correct 730 ms 2092 KB Output is correct
88 Correct 710 ms 2048 KB Output is correct
89 Correct 217 ms 1936 KB Output is correct
90 Correct 70 ms 1092 KB Output is correct
91 Correct 181 ms 2096 KB Output is correct
92 Correct 807 ms 2364 KB Output is correct
93 Correct 479 ms 2532 KB Output is correct
94 Correct 26 ms 1860 KB Output is correct
95 Correct 62 ms 1872 KB Output is correct
96 Correct 47 ms 1240 KB Output is correct
97 Correct 222 ms 1368 KB Output is correct
98 Correct 333 ms 1556 KB Output is correct
99 Correct 74 ms 1596 KB Output is correct
100 Correct 312 ms 2260 KB Output is correct
101 Correct 65 ms 1996 KB Output is correct
102 Correct 404 ms 2348 KB Output is correct
103 Correct 205 ms 2284 KB Output is correct
104 Correct 433 ms 2084 KB Output is correct
105 Correct 882 ms 2376 KB Output is correct
106 Correct 47 ms 1724 KB Output is correct
107 Correct 1254 ms 2324 KB Output is correct
108 Correct 214 ms 1844 KB Output is correct
109 Correct 226 ms 1880 KB Output is correct
110 Correct 311 ms 2344 KB Output is correct
111 Correct 372 ms 2160 KB Output is correct
112 Correct 717 ms 2408 KB Output is correct
113 Correct 178 ms 2104 KB Output is correct
114 Correct 379 ms 2348 KB Output is correct
115 Correct 69 ms 2080 KB Output is correct
116 Correct 759 ms 2332 KB Output is correct
117 Correct 145 ms 2152 KB Output is correct
118 Correct 1012 ms 2612 KB Output is correct
119 Correct 179 ms 2080 KB Output is correct
120 Correct 667 ms 2492 KB Output is correct
121 Correct 392 ms 2376 KB Output is correct
122 Correct 397 ms 2344 KB Output is correct
123 Correct 170 ms 2144 KB Output is correct
124 Correct 564 ms 2448 KB Output is correct
125 Correct 269 ms 2200 KB Output is correct
126 Correct 40 ms 1988 KB Output is correct
127 Correct 866 ms 2440 KB Output is correct
128 Correct 0 ms 340 KB Output is correct
129 Execution timed out 10100 ms 26068 KB Time limit exceeded
130 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 1 ms 456 KB Output is correct
3 Correct 1 ms 412 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 416 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 440 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 324 KB Output is correct
31 Correct 1 ms 412 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 424 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 1 ms 332 KB Output is correct
37 Correct 1 ms 460 KB Output is correct
38 Correct 1 ms 460 KB Output is correct
39 Correct 1 ms 412 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 1 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 1 ms 460 KB Output is correct
44 Correct 1 ms 332 KB Output is correct
45 Correct 2 ms 332 KB Output is correct
46 Correct 1 ms 460 KB Output is correct
47 Correct 1 ms 416 KB Output is correct
48 Correct 1 ms 416 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 1 ms 408 KB Output is correct
51 Correct 1 ms 332 KB Output is correct
52 Correct 1 ms 332 KB Output is correct
53 Correct 1 ms 340 KB Output is correct
54 Correct 1 ms 412 KB Output is correct
55 Correct 1 ms 332 KB Output is correct
56 Correct 1 ms 332 KB Output is correct
57 Correct 1 ms 332 KB Output is correct
58 Correct 1 ms 408 KB Output is correct
59 Correct 0 ms 276 KB Output is correct
60 Correct 114 ms 980 KB Output is correct
61 Correct 47 ms 844 KB Output is correct
62 Correct 65 ms 1068 KB Output is correct
63 Correct 272 ms 2008 KB Output is correct
64 Correct 2903 ms 2852 KB Output is correct
65 Correct 72 ms 1816 KB Output is correct
66 Correct 35 ms 1968 KB Output is correct
67 Correct 2976 ms 2936 KB Output is correct
68 Correct 99 ms 1220 KB Output is correct
69 Correct 9 ms 984 KB Output is correct
70 Correct 153 ms 2120 KB Output is correct
71 Correct 55 ms 1188 KB Output is correct
72 Correct 58 ms 1280 KB Output is correct
73 Correct 187 ms 1296 KB Output is correct
74 Correct 1016 ms 2284 KB Output is correct
75 Correct 85 ms 2140 KB Output is correct
76 Correct 171 ms 2200 KB Output is correct
77 Correct 12 ms 1148 KB Output is correct
78 Correct 23 ms 1228 KB Output is correct
79 Correct 12 ms 1188 KB Output is correct
80 Correct 552 ms 1876 KB Output is correct
81 Correct 717 ms 1960 KB Output is correct
82 Correct 86 ms 2088 KB Output is correct
83 Correct 322 ms 2512 KB Output is correct
84 Correct 75 ms 2108 KB Output is correct
85 Correct 1304 ms 2500 KB Output is correct
86 Correct 60 ms 2072 KB Output is correct
87 Correct 730 ms 2092 KB Output is correct
88 Correct 710 ms 2048 KB Output is correct
89 Correct 217 ms 1936 KB Output is correct
90 Correct 70 ms 1092 KB Output is correct
91 Correct 181 ms 2096 KB Output is correct
92 Correct 807 ms 2364 KB Output is correct
93 Correct 479 ms 2532 KB Output is correct
94 Correct 26 ms 1860 KB Output is correct
95 Correct 62 ms 1872 KB Output is correct
96 Correct 47 ms 1240 KB Output is correct
97 Correct 222 ms 1368 KB Output is correct
98 Correct 333 ms 1556 KB Output is correct
99 Correct 74 ms 1596 KB Output is correct
100 Correct 312 ms 2260 KB Output is correct
101 Correct 65 ms 1996 KB Output is correct
102 Correct 404 ms 2348 KB Output is correct
103 Correct 205 ms 2284 KB Output is correct
104 Correct 433 ms 2084 KB Output is correct
105 Correct 882 ms 2376 KB Output is correct
106 Correct 47 ms 1724 KB Output is correct
107 Correct 1254 ms 2324 KB Output is correct
108 Correct 214 ms 1844 KB Output is correct
109 Correct 226 ms 1880 KB Output is correct
110 Correct 311 ms 2344 KB Output is correct
111 Correct 372 ms 2160 KB Output is correct
112 Correct 717 ms 2408 KB Output is correct
113 Correct 178 ms 2104 KB Output is correct
114 Correct 379 ms 2348 KB Output is correct
115 Correct 69 ms 2080 KB Output is correct
116 Correct 759 ms 2332 KB Output is correct
117 Correct 145 ms 2152 KB Output is correct
118 Correct 1012 ms 2612 KB Output is correct
119 Correct 179 ms 2080 KB Output is correct
120 Correct 667 ms 2492 KB Output is correct
121 Correct 392 ms 2376 KB Output is correct
122 Correct 397 ms 2344 KB Output is correct
123 Correct 170 ms 2144 KB Output is correct
124 Correct 564 ms 2448 KB Output is correct
125 Correct 269 ms 2200 KB Output is correct
126 Correct 40 ms 1988 KB Output is correct
127 Correct 866 ms 2440 KB Output is correct
128 Correct 0 ms 340 KB Output is correct
129 Execution timed out 10100 ms 26068 KB Time limit exceeded
130 Halted 0 ms 0 KB -