답안 #533238

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
533238 2022-03-05T07:29:04 Z lunchbox 새 집 (APIO18_new_home) C
100 / 100
2727 ms 72604 KB
#include <stdio.h>
#include <sys/time.h>

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

#define N	300000
#define K	300000
#define Q	300000
#define M	(300000 + 2)
#define M_	(1 << 19)	/* M_ = pow2(ceil(log2(M))) */	
#define T	(K * 3 + N * 6)
#define INF	0x3f3f3f3f

unsigned int X;
 
void srand_() {
	struct timeval tv;
 
	gettimeofday(&tv, NULL);
	X = tv.tv_sec ^ tv.tv_usec | 1;
}
 
int rand_() {
	return (X *= 3) >> 1;
}

int *vv;

void sort(int *hh, int l, int r) {
	while (l < r) {
		int i = l, j = l, k = r, h_ = hh[l + rand_() % (r - l)], tmp;
 
		while (j < k) {
			int c = vv[hh[j]] - vv[h_];
 
			if (c == 0)
				j++;
			else if (c < 0) {
				tmp = hh[i], hh[i] = hh[j], hh[j] = tmp;
				i++, j++;
			} else {
				k--;
				tmp = hh[j], hh[j] = hh[k], hh[k] = tmp;
			}
		}
		sort(hh, l, i);
		l = k;
	}
}

int zz[T + 1], ll[T + 1], rr[T + 1], kk[T + 1], cnt[T + 1];
 
int node(int key) {
	static int _ = 1;
 
	zz[_] = rand_();
	kk[_] = key;
	return _++;
}
 
int l_, r_;

int i_;

void split_(int i, int key) {
	if (i == 0) {
		i_ = l_ = r_ = 0;
		return;
	}
	if (kk[i] < key) {
		split_(rr[i], key);
		rr[i] = l_, l_ = i;
	} else if (kk[i] > key) {
		split_(ll[i], key);
		ll[i] = r_, r_ = i;
	} else {
		i_ = i, l_ = ll[i], r_ = rr[i];
		ll[i] = rr[i] = 0;
	}
}

int merge(int i, int j) {
	if (i == 0)
		return j;
	if (j == 0)
		return i;
	if (zz[i] < zz[j]) {
		rr[i] = merge(rr[i], j);
		return i;
	} else {
		ll[j] = merge(i, ll[j]);
		return j;
	}
}

void split(int i, int key) {
	split_(i, key);
	r_ = merge(i_, r_);
}

int first(int i) {
	while (ll[i] != 0)
		i = ll[i];
	return i;
}

int last(int i) {
	while (rr[i] != 0)
		i = rr[i];
	return i;
}

int add(int i, int key) {
	split_(i, key);
	if (i_ == 0)
		i_ = node(key);
	cnt[i_]++;
	return merge(l_, merge(i_, r_));
}

int erase(int i, int key) {
	split_(i, key);
	if (--cnt[i_] == 0)
		i_ = 0;
	return merge(l_, merge(i_, r_));
}


int aa[M], m;

int ii(int a) {
	int lower = 0, upper = m - 1;

	while (lower < upper) {
		int t = (lower + upper) / 2;

		if (aa[t] < a)
			lower = t + 1;
		else if (aa[t] > a)
			upper = t - 1;
		else
			lower = upper = t;
	}
	return lower;
}

int st[M_ * 2], mx[M_ * 2], m_;

void build(int *aa, int m) {
	int i;

	m_ = 1;
	while (m_ < m)
		m_ <<= 1;
	for (i = 0; i < m_; i++) {
		st[m_ + i] = INF;
		mx[m_ + i] = i < m ? aa[i] : -INF;
	}
	for (i = m_ - 1; i > 0; i--) {
		st[i] = min(st[i << 1 | 0], st[i << 1 | 1]);
		mx[i]  = max(mx[i << 1 | 0], mx[i << 1 | 1]);
	}
}

void update(int i, int x) {
	st[i += m_] = x;
	while (i > 1) {
		i >>= 1;
		st[i] = min(st[i << 1 | 0], st[i << 1 | 1]);
	}
}

int tr_[M];

void update_(int l, int r, int t) {
	r = ii(r);
	if (t == +1)
		tr_[r] = add(tr_[r], l);
	else
		tr_[r] = erase(tr_[r], l);
	update(r, tr_[r] == 0 ? INF : kk[first(tr_[r])]);
}

int query(int x) {
	int i = 1, v = INF;

	while (i < m_) {
		if (x > mx[i << 1 | 0]) {
			i = i << 1 | 1;
			continue;
		}
		if (mx[i << 1 | 0] + 1 + min(st[i << 1 | 1], v) <= 2 * x)
			i = i << 1 | 1;
		else {
			v = min(v, st[i << 1 | 1]);
			i = i << 1 | 0;
		}
	}
	return min(2 * x - min(v, st[i]), mx[i]) - x;
}

int main() {
	static int xx[N], gg[N], ll[N], rr[N], yy[Q], tt[Q], ans[Q];
	static int hh[M], hh0[N], hh1[N], hh2[Q];
	static int tr[K], cnt_[K];
	int n, k, q, i, i0, i1, i2, active;

	srand_();
	scanf("%d%d%d", &n, &k, &q);
	for (i = 0; i < n; i++) {
		scanf("%d%d%d%d", &xx[i], &gg[i], &ll[i], &rr[i]), gg[i]--;
		hh[i] = i;
		hh0[i] = i;
		hh1[i] = i;
	}
	for (i = 0; i < q; i++) {
		scanf("%d%d", &yy[i], &tt[i]);
		hh2[i] = i;
	}
	vv = xx, sort(hh, 0, n);
	vv = ll, sort(hh0, 0, n);
	vv = rr, sort(hh1, 0, n);
	vv = tt, sort(hh2, 0, q);
	for (i = 0; i < k; i++) {
		tr[i] = add(tr[i], -INF);
		tr[i] = add(tr[i], +INF);
		update_(-INF, +INF, +1);
	}
	m = 0;
	aa[m++] = -INF;
	for (i = 0; i < n; i++)
		if (i == 0 || xx[hh[i]] != xx[hh[i - 1]])
			aa[m++] = xx[hh[i]];
	aa[m++] = +INF;
	build(aa, m);
	i0 = i1 = i2 = 0;
	active = 0;
	for (i = 0; i < q; i++) {
		int h, g, x, l, r, prev, next;

		while (i0 < n && ll[hh0[i0]] <= tt[hh2[i]]) {
			h = hh0[i0], g = gg[h], x = xx[h];
			split(tr[g], x);
			l = l_, r = r_;
			prev = last(l);
			next = first(r);
			update_(kk[prev], kk[next], -1);
			update_(kk[prev], x, +1);
			update_(x, kk[next], +1);
			tr[g] = add(merge(l, r), x);
			if (++cnt_[g] == 1)
				active++;
			i0++;
		}
		while (i1 < n && rr[hh1[i1]] < tt[hh2[i]]) {
			h = hh1[i1], g = gg[h], x = xx[h];
			tr[g] = erase(tr[g], x);
			split(tr[g], x);
			l = l_, r = r_;
			prev = last(l);
			next = first(r);
			update_(kk[prev], kk[next], +1);
			update_(kk[prev], x, -1);
			update_(x, kk[next], -1);
			tr[g] = merge(l, r);
			if (--cnt_[g] == 0)
				active--;
			i1++;
		}
		ans[hh2[i]] = active == k ? query(yy[hh2[i]]) : -1;
	}
	for (i = 0; i < q; i++)
		printf("%d\n", ans[i]);
	return 0;
}

Compilation message

new_home.c: In function 'srand_':
new_home.c:21:16: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
   21 |  X = tv.tv_sec ^ tv.tv_usec | 1;
      |      ~~~~~~~~~~^~~~~~~~~~~~
new_home.c: In function 'main':
new_home.c:210:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
  210 |  scanf("%d%d%d", &n, &k, &q);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
new_home.c:212:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
  212 |   scanf("%d%d%d%d", &xx[i], &gg[i], &ll[i], &rr[i]), gg[i]--;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
new_home.c:218:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
  218 |   scanf("%d%d", &yy[i], &tt[i]);
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 416 KB Output is correct
3 Correct 0 ms 420 KB Output is correct
4 Correct 0 ms 416 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 428 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 2 ms 408 KB Output is correct
9 Correct 2 ms 456 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 432 KB Output is correct
14 Correct 1 ms 460 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 460 KB Output is correct
17 Correct 2 ms 432 KB Output is correct
18 Correct 1 ms 460 KB Output is correct
19 Correct 2 ms 460 KB Output is correct
20 Correct 2 ms 460 KB Output is correct
21 Correct 1 ms 460 KB Output is correct
22 Correct 1 ms 460 KB Output is correct
23 Correct 1 ms 460 KB Output is correct
24 Correct 1 ms 460 KB Output is correct
25 Correct 2 ms 460 KB Output is correct
26 Correct 1 ms 460 KB Output is correct
27 Correct 1 ms 420 KB Output is correct
28 Correct 1 ms 460 KB Output is correct
29 Correct 2 ms 460 KB Output is correct
30 Correct 1 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 416 KB Output is correct
3 Correct 0 ms 420 KB Output is correct
4 Correct 0 ms 416 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 428 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 2 ms 408 KB Output is correct
9 Correct 2 ms 456 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 432 KB Output is correct
14 Correct 1 ms 460 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 460 KB Output is correct
17 Correct 2 ms 432 KB Output is correct
18 Correct 1 ms 460 KB Output is correct
19 Correct 2 ms 460 KB Output is correct
20 Correct 2 ms 460 KB Output is correct
21 Correct 1 ms 460 KB Output is correct
22 Correct 1 ms 460 KB Output is correct
23 Correct 1 ms 460 KB Output is correct
24 Correct 1 ms 460 KB Output is correct
25 Correct 2 ms 460 KB Output is correct
26 Correct 1 ms 460 KB Output is correct
27 Correct 1 ms 420 KB Output is correct
28 Correct 1 ms 460 KB Output is correct
29 Correct 2 ms 460 KB Output is correct
30 Correct 1 ms 460 KB Output is correct
31 Correct 233 ms 12596 KB Output is correct
32 Correct 77 ms 3968 KB Output is correct
33 Correct 276 ms 12508 KB Output is correct
34 Correct 253 ms 12600 KB Output is correct
35 Correct 246 ms 12500 KB Output is correct
36 Correct 316 ms 12388 KB Output is correct
37 Correct 201 ms 12488 KB Output is correct
38 Correct 242 ms 12264 KB Output is correct
39 Correct 163 ms 12448 KB Output is correct
40 Correct 201 ms 12304 KB Output is correct
41 Correct 172 ms 12584 KB Output is correct
42 Correct 243 ms 12428 KB Output is correct
43 Correct 51 ms 5804 KB Output is correct
44 Correct 182 ms 12720 KB Output is correct
45 Correct 177 ms 12556 KB Output is correct
46 Correct 146 ms 12556 KB Output is correct
47 Correct 142 ms 11712 KB Output is correct
48 Correct 122 ms 11768 KB Output is correct
49 Correct 136 ms 12108 KB Output is correct
50 Correct 159 ms 12220 KB Output is correct
51 Correct 129 ms 12072 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1179 ms 60588 KB Output is correct
2 Correct 1351 ms 55452 KB Output is correct
3 Correct 1292 ms 71956 KB Output is correct
4 Correct 1093 ms 62520 KB Output is correct
5 Correct 1339 ms 54952 KB Output is correct
6 Correct 1315 ms 55372 KB Output is correct
7 Correct 1062 ms 72076 KB Output is correct
8 Correct 842 ms 62416 KB Output is correct
9 Correct 741 ms 59112 KB Output is correct
10 Correct 784 ms 56428 KB Output is correct
11 Correct 589 ms 55084 KB Output is correct
12 Correct 586 ms 56412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1806 ms 62768 KB Output is correct
2 Correct 353 ms 18112 KB Output is correct
3 Correct 2542 ms 61192 KB Output is correct
4 Correct 2332 ms 69880 KB Output is correct
5 Correct 2007 ms 63124 KB Output is correct
6 Correct 2096 ms 64332 KB Output is correct
7 Correct 2613 ms 60684 KB Output is correct
8 Correct 2470 ms 60956 KB Output is correct
9 Correct 2214 ms 71092 KB Output is correct
10 Correct 1727 ms 64868 KB Output is correct
11 Correct 1407 ms 63492 KB Output is correct
12 Correct 1628 ms 61944 KB Output is correct
13 Correct 834 ms 59672 KB Output is correct
14 Correct 784 ms 59064 KB Output is correct
15 Correct 880 ms 60412 KB Output is correct
16 Correct 888 ms 61668 KB Output is correct
17 Correct 983 ms 60232 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 416 KB Output is correct
3 Correct 0 ms 420 KB Output is correct
4 Correct 0 ms 416 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 428 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 2 ms 408 KB Output is correct
9 Correct 2 ms 456 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 432 KB Output is correct
14 Correct 1 ms 460 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 460 KB Output is correct
17 Correct 2 ms 432 KB Output is correct
18 Correct 1 ms 460 KB Output is correct
19 Correct 2 ms 460 KB Output is correct
20 Correct 2 ms 460 KB Output is correct
21 Correct 1 ms 460 KB Output is correct
22 Correct 1 ms 460 KB Output is correct
23 Correct 1 ms 460 KB Output is correct
24 Correct 1 ms 460 KB Output is correct
25 Correct 2 ms 460 KB Output is correct
26 Correct 1 ms 460 KB Output is correct
27 Correct 1 ms 420 KB Output is correct
28 Correct 1 ms 460 KB Output is correct
29 Correct 2 ms 460 KB Output is correct
30 Correct 1 ms 460 KB Output is correct
31 Correct 233 ms 12596 KB Output is correct
32 Correct 77 ms 3968 KB Output is correct
33 Correct 276 ms 12508 KB Output is correct
34 Correct 253 ms 12600 KB Output is correct
35 Correct 246 ms 12500 KB Output is correct
36 Correct 316 ms 12388 KB Output is correct
37 Correct 201 ms 12488 KB Output is correct
38 Correct 242 ms 12264 KB Output is correct
39 Correct 163 ms 12448 KB Output is correct
40 Correct 201 ms 12304 KB Output is correct
41 Correct 172 ms 12584 KB Output is correct
42 Correct 243 ms 12428 KB Output is correct
43 Correct 51 ms 5804 KB Output is correct
44 Correct 182 ms 12720 KB Output is correct
45 Correct 177 ms 12556 KB Output is correct
46 Correct 146 ms 12556 KB Output is correct
47 Correct 142 ms 11712 KB Output is correct
48 Correct 122 ms 11768 KB Output is correct
49 Correct 136 ms 12108 KB Output is correct
50 Correct 159 ms 12220 KB Output is correct
51 Correct 129 ms 12072 KB Output is correct
52 Correct 271 ms 14008 KB Output is correct
53 Correct 252 ms 14064 KB Output is correct
54 Correct 242 ms 12908 KB Output is correct
55 Correct 206 ms 13256 KB Output is correct
56 Correct 209 ms 13648 KB Output is correct
57 Correct 200 ms 12744 KB Output is correct
58 Correct 224 ms 13120 KB Output is correct
59 Correct 234 ms 13536 KB Output is correct
60 Correct 214 ms 12672 KB Output is correct
61 Correct 54 ms 9928 KB Output is correct
62 Correct 265 ms 14176 KB Output is correct
63 Correct 248 ms 13480 KB Output is correct
64 Correct 258 ms 13148 KB Output is correct
65 Correct 227 ms 12700 KB Output is correct
66 Correct 228 ms 12632 KB Output is correct
67 Correct 120 ms 5832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 416 KB Output is correct
3 Correct 0 ms 420 KB Output is correct
4 Correct 0 ms 416 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 428 KB Output is correct
7 Correct 2 ms 456 KB Output is correct
8 Correct 2 ms 408 KB Output is correct
9 Correct 2 ms 456 KB Output is correct
10 Correct 2 ms 492 KB Output is correct
11 Correct 1 ms 460 KB Output is correct
12 Correct 1 ms 460 KB Output is correct
13 Correct 1 ms 432 KB Output is correct
14 Correct 1 ms 460 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 460 KB Output is correct
17 Correct 2 ms 432 KB Output is correct
18 Correct 1 ms 460 KB Output is correct
19 Correct 2 ms 460 KB Output is correct
20 Correct 2 ms 460 KB Output is correct
21 Correct 1 ms 460 KB Output is correct
22 Correct 1 ms 460 KB Output is correct
23 Correct 1 ms 460 KB Output is correct
24 Correct 1 ms 460 KB Output is correct
25 Correct 2 ms 460 KB Output is correct
26 Correct 1 ms 460 KB Output is correct
27 Correct 1 ms 420 KB Output is correct
28 Correct 1 ms 460 KB Output is correct
29 Correct 2 ms 460 KB Output is correct
30 Correct 1 ms 460 KB Output is correct
31 Correct 233 ms 12596 KB Output is correct
32 Correct 77 ms 3968 KB Output is correct
33 Correct 276 ms 12508 KB Output is correct
34 Correct 253 ms 12600 KB Output is correct
35 Correct 246 ms 12500 KB Output is correct
36 Correct 316 ms 12388 KB Output is correct
37 Correct 201 ms 12488 KB Output is correct
38 Correct 242 ms 12264 KB Output is correct
39 Correct 163 ms 12448 KB Output is correct
40 Correct 201 ms 12304 KB Output is correct
41 Correct 172 ms 12584 KB Output is correct
42 Correct 243 ms 12428 KB Output is correct
43 Correct 51 ms 5804 KB Output is correct
44 Correct 182 ms 12720 KB Output is correct
45 Correct 177 ms 12556 KB Output is correct
46 Correct 146 ms 12556 KB Output is correct
47 Correct 142 ms 11712 KB Output is correct
48 Correct 122 ms 11768 KB Output is correct
49 Correct 136 ms 12108 KB Output is correct
50 Correct 159 ms 12220 KB Output is correct
51 Correct 129 ms 12072 KB Output is correct
52 Correct 1179 ms 60588 KB Output is correct
53 Correct 1351 ms 55452 KB Output is correct
54 Correct 1292 ms 71956 KB Output is correct
55 Correct 1093 ms 62520 KB Output is correct
56 Correct 1339 ms 54952 KB Output is correct
57 Correct 1315 ms 55372 KB Output is correct
58 Correct 1062 ms 72076 KB Output is correct
59 Correct 842 ms 62416 KB Output is correct
60 Correct 741 ms 59112 KB Output is correct
61 Correct 784 ms 56428 KB Output is correct
62 Correct 589 ms 55084 KB Output is correct
63 Correct 586 ms 56412 KB Output is correct
64 Correct 1806 ms 62768 KB Output is correct
65 Correct 353 ms 18112 KB Output is correct
66 Correct 2542 ms 61192 KB Output is correct
67 Correct 2332 ms 69880 KB Output is correct
68 Correct 2007 ms 63124 KB Output is correct
69 Correct 2096 ms 64332 KB Output is correct
70 Correct 2613 ms 60684 KB Output is correct
71 Correct 2470 ms 60956 KB Output is correct
72 Correct 2214 ms 71092 KB Output is correct
73 Correct 1727 ms 64868 KB Output is correct
74 Correct 1407 ms 63492 KB Output is correct
75 Correct 1628 ms 61944 KB Output is correct
76 Correct 834 ms 59672 KB Output is correct
77 Correct 784 ms 59064 KB Output is correct
78 Correct 880 ms 60412 KB Output is correct
79 Correct 888 ms 61668 KB Output is correct
80 Correct 983 ms 60232 KB Output is correct
81 Correct 271 ms 14008 KB Output is correct
82 Correct 252 ms 14064 KB Output is correct
83 Correct 242 ms 12908 KB Output is correct
84 Correct 206 ms 13256 KB Output is correct
85 Correct 209 ms 13648 KB Output is correct
86 Correct 200 ms 12744 KB Output is correct
87 Correct 224 ms 13120 KB Output is correct
88 Correct 234 ms 13536 KB Output is correct
89 Correct 214 ms 12672 KB Output is correct
90 Correct 54 ms 9928 KB Output is correct
91 Correct 265 ms 14176 KB Output is correct
92 Correct 248 ms 13480 KB Output is correct
93 Correct 258 ms 13148 KB Output is correct
94 Correct 227 ms 12700 KB Output is correct
95 Correct 228 ms 12632 KB Output is correct
96 Correct 120 ms 5832 KB Output is correct
97 Correct 2400 ms 71832 KB Output is correct
98 Correct 380 ms 18572 KB Output is correct
99 Correct 2727 ms 63328 KB Output is correct
100 Correct 2172 ms 72604 KB Output is correct
101 Correct 2089 ms 66224 KB Output is correct
102 Correct 2531 ms 63156 KB Output is correct
103 Correct 1331 ms 63536 KB Output is correct
104 Correct 1428 ms 62980 KB Output is correct
105 Correct 994 ms 63024 KB Output is correct
106 Correct 1062 ms 62996 KB Output is correct
107 Correct 1470 ms 68036 KB Output is correct
108 Correct 1610 ms 69348 KB Output is correct
109 Correct 1278 ms 66160 KB Output is correct
110 Correct 1551 ms 67492 KB Output is correct
111 Correct 1728 ms 68772 KB Output is correct
112 Correct 1363 ms 65452 KB Output is correct
113 Correct 268 ms 48520 KB Output is correct
114 Correct 2280 ms 72484 KB Output is correct
115 Correct 2237 ms 68372 KB Output is correct
116 Correct 2242 ms 67152 KB Output is correct
117 Correct 1907 ms 65636 KB Output is correct
118 Correct 1324 ms 65028 KB Output is correct
119 Correct 689 ms 27624 KB Output is correct
120 Correct 614 ms 57764 KB Output is correct
121 Correct 637 ms 61164 KB Output is correct
122 Correct 637 ms 60900 KB Output is correct
123 Correct 723 ms 62380 KB Output is correct
124 Correct 821 ms 63180 KB Output is correct
125 Correct 730 ms 62688 KB Output is correct
126 Correct 886 ms 62940 KB Output is correct