Submission #49132

# Submission time Handle Problem Language Result Execution time Memory
49132 2018-05-22T15:33:51 Z samuelfgs96 New Home (APIO18_new_home) C++11
100 / 100
4077 ms 71432 KB
#include <bits/stdc++.h>
 
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF 0x3f3f3f3f
 
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int N = 500000;

int x[N], t[N], a[N], b[N], l[N], y[N];
int ans[N];
bool flag;
vector <pii> values;
struct segtree {
	vector <int> seg;
	int n, k, a, b, t;
	segtree() { }
	segtree(int n, int t) : n(n), t(t) {
		if (t)
			seg.resize(4*n+1, INT_MAX);
		else
			seg.resize(4*n+1, -1);
	}
	int operador (int x, int y) {
		return t ? min(x, y) : max(x, y);
	}
	void update (int r, int i, int j) {
		if (i > b or j < a) return ;
		if (i >= a and j <= b) {
			seg[r] = k;
			return ;
		}
		int mid = (i + j) / 2;
		update (r*2, i, mid);
		update (r*2+1, mid+1, j);
		seg[r] = operador(seg[r*2], seg[r*2+1]);
//		if (t == 1) cout << r << " " << i << " " << j << ": " << seg[r] << endl;
	}
	int query_left (int r, int i, int j) {
		if (i > b or j < a) return -1;
		int mid = (i + j) / 2;
		if (i >= a and j <= b) {
			if (seg[r] < k) return -1;
			if (i == j) return i;
			
			if (seg[r*2] >= k) return query_left(r*2, i, mid);
			return query_left(r*2+1, mid+1, j);
		}
		int l = query_left(r*2, i, mid);
		return l == -1 ? query_left(r*2+1, mid+1, j) : l;
	}
	int query_right (int r, int i, int j) {
//		printf("query_right i %d j %d a %d b %d segr %d\n", i, j, a, b, seg[r]);
		if (i > b or j < a) return -1;
		int mid = (i + j) / 2;
		if (i >= a and j <= b) {
			if (seg[r] > k) return -1;
			if (i == j) return i;
			if (seg[r*2+1] <= k) return query_right(r*2+1, mid+1, j);
			return query_right(r*2, i, mid);
		}
		int l = query_right(r*2+1, mid+1, j);
		return l == -1 ? query_right(r*2, i, mid) : l;
	}
	void update (int id, int val) {
//		printf("update \t st %d id %d x %d val %d\n", t, id, x[id], val);
		a = b = lower_bound(values.begin(), values.end(), mp(x[id], id)) - values.begin();
//		printf("\t a %d b %d\n", a, b);
		k = val;
		update (1, 0, n-1);
	}
	int query_left (int pos, int val) {
		a = 0;
		b = upper_bound(values.begin(), values.end(), mp(pos, INF)) - values.begin() - 1;
		if (a > b) return -1;
		k = val;
		return query_left (1, 0, n-1);
	}
	int query_right (int pos, int val) {
		a = lower_bound(values.begin(), values.end(), mp(pos, -1)) - values.begin();
		b = n-1;
		if (a > b) return -1;
		k = val;
		if (flag)
		cout << a << " " << b << " " << k << " " << seg[1] << endl;
		return query_right(1, 0, n-1);
	}
} st[2];

set <pii> active[N];
set<pii>::iterator it;
//left  update 0
//right update 1
void add (int left, int right) {
	if (x[left] == x[right]) {
		st[0].update(left, x[left]);
		st[1].update(right, x[right]);
		return ;
	}
	int mid = (x[left] + x[right]) / 2;
	st[0].update(left, mid);
	st[1].update(right, mid+1);
}
void remove (int left, int right) {
	st[0].update(left, -1);
	st[1].update(right, INF);
}
int main (void) {
	int n, k, q;
	scanf("%d %d %d", &n, &k, &q);
	vector < tuple<int, int, int> > evt;
	for (int i = 0; i < n; i++) {
		scanf("%d %d %d %d", x+i, t+i, a+i, b+i);
		evt.eb(a[i], 0, i);
		evt.eb(b[i], 2, i);
		values.eb(x[i], i);
	}
	for (int i = 0; i < q; i++) {
		scanf("%d %d", l+i, y+i);
//		cout << l[i] << " " << y[i] << endl;
		evt.eb(y[i], 1, i);
	}
	sort(evt.begin(), evt.end());
	sort(values.begin(), values.end());
//	for (int i = 0; i < n; i++)
//		printf("%d: %d %d\n", i, values[i].fi, values[i].se);
//	printf("------------\n");
	st[0] = segtree(n, 0); //maximo
	st[1] = segtree(n, 1); //minimo
	int cnt = 0;
	int w = 0;
	for (int i = 0; i < evt.size(); i++) {
		int coord, tipo, id; tie(coord, tipo, id) = evt[i];
//		cout << coord << " " << tipo << " " << id << endl;
		if (!tipo) { //inserir
//			printf("add t %d x %d\n", t[id], x[id]);
			if (active[t[id]].empty()) {
				st[0].update(id, INF);
				st[1].update(id, -1);
				active[t[id]].insert(mp(x[id], id));
				cnt++;
				continue;
			}
			it = active[t[id]].lower_bound(mp(x[id], id));
			if (it != active[t[id]].end()) add(id, it->se);
			else st[0].update(id, INF);

			if (it != active[t[id]].begin()) {
				it--;
				add(it->se, id);
			} else st[1].update(id, -1);
			active[t[id]].insert(mp(x[id], id));
		} else if (tipo == 2) {
//			printf("rem t %d x %d\n", t[id], x[id]);
			it = active[t[id]].lower_bound(mp(x[id], id+1));
			if (it != active[t[id]].end()) remove(id, it->se);
			else st[0].update(id, -1);

			it = active[t[id]].lower_bound(mp(x[id], id));
			if (it != active[t[id]].begin()) {
				it--;
				remove(it->se, id);
			} else st[1].update(id, INF);

			active[t[id]].erase(mp(x[id], id));

			if (active[t[id]].empty()) {
				cnt--;
				continue;
			}
			int l = -1, r = INF;
			it = active[t[id]].lower_bound(mp(x[id], id+1));
			if (it != active[t[id]].end()) r = it->se;
			if (it != active[t[id]].begin()) {
				it--;
				l = it->se;
			}

			if (l == -1) st[1].update(r, -1);
			else if (r == INF) st[0].update(l, INF);
			else add(l, r);
		} else { //query
			int x = st[0].query_left(l[id], l[id]);
			int y = st[1].query_right(l[id], l[id]);
//			printf("x %d y %d\n", x, y);	
//			if (x != -1) cout << values[x].fi << " " << values[x].se << endl;
//			if (y != -1) cout << values[y].fi << " " << values[y].se << endl;
			if (x == -1 and y == -1) ans[id] = -1;
			else if (y == -1) ans[id] = l[id] - values[x].fi;
			else if (x == -1) ans[id] = values[y].fi - l[id];
			else ans[id] = max(values[y].fi -l[id], l[id] - values[x].fi);

			if (cnt != k) ans[id] = -1;
		}		
	}
	for (int i = 0; i < q; i++)
		printf("%d\n", ans[i]);
	return 0;
}

Compilation message

new_home.cpp: In function 'int main()':
new_home.cpp:139:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < evt.size(); i++) {
                  ~~^~~~~~~~~~~~
new_home.cpp:138:6: warning: unused variable 'w' [-Wunused-variable]
  int w = 0;
      ^
new_home.cpp:117:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d", &n, &k, &q);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
new_home.cpp:120:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d %d", x+i, t+i, a+i, b+i);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
new_home.cpp:126:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", l+i, y+i);
   ~~~~~^~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 21 ms 23800 KB Output is correct
2 Correct 24 ms 23908 KB Output is correct
3 Correct 21 ms 23984 KB Output is correct
4 Correct 20 ms 23984 KB Output is correct
5 Correct 22 ms 24020 KB Output is correct
6 Correct 22 ms 24036 KB Output is correct
7 Correct 22 ms 24088 KB Output is correct
8 Correct 22 ms 24088 KB Output is correct
9 Correct 22 ms 24144 KB Output is correct
10 Correct 26 ms 24180 KB Output is correct
11 Correct 28 ms 24184 KB Output is correct
12 Correct 27 ms 24184 KB Output is correct
13 Correct 24 ms 24184 KB Output is correct
14 Correct 25 ms 24184 KB Output is correct
15 Correct 25 ms 24184 KB Output is correct
16 Correct 24 ms 24196 KB Output is correct
17 Correct 25 ms 24196 KB Output is correct
18 Correct 24 ms 24196 KB Output is correct
19 Correct 28 ms 24196 KB Output is correct
20 Correct 27 ms 24196 KB Output is correct
21 Correct 26 ms 24196 KB Output is correct
22 Correct 26 ms 24196 KB Output is correct
23 Correct 23 ms 24196 KB Output is correct
24 Correct 22 ms 24296 KB Output is correct
25 Correct 21 ms 24296 KB Output is correct
26 Correct 24 ms 24296 KB Output is correct
27 Correct 22 ms 24296 KB Output is correct
28 Correct 26 ms 24296 KB Output is correct
29 Correct 25 ms 24296 KB Output is correct
30 Correct 21 ms 24296 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 23800 KB Output is correct
2 Correct 24 ms 23908 KB Output is correct
3 Correct 21 ms 23984 KB Output is correct
4 Correct 20 ms 23984 KB Output is correct
5 Correct 22 ms 24020 KB Output is correct
6 Correct 22 ms 24036 KB Output is correct
7 Correct 22 ms 24088 KB Output is correct
8 Correct 22 ms 24088 KB Output is correct
9 Correct 22 ms 24144 KB Output is correct
10 Correct 26 ms 24180 KB Output is correct
11 Correct 28 ms 24184 KB Output is correct
12 Correct 27 ms 24184 KB Output is correct
13 Correct 24 ms 24184 KB Output is correct
14 Correct 25 ms 24184 KB Output is correct
15 Correct 25 ms 24184 KB Output is correct
16 Correct 24 ms 24196 KB Output is correct
17 Correct 25 ms 24196 KB Output is correct
18 Correct 24 ms 24196 KB Output is correct
19 Correct 28 ms 24196 KB Output is correct
20 Correct 27 ms 24196 KB Output is correct
21 Correct 26 ms 24196 KB Output is correct
22 Correct 26 ms 24196 KB Output is correct
23 Correct 23 ms 24196 KB Output is correct
24 Correct 22 ms 24296 KB Output is correct
25 Correct 21 ms 24296 KB Output is correct
26 Correct 24 ms 24296 KB Output is correct
27 Correct 22 ms 24296 KB Output is correct
28 Correct 26 ms 24296 KB Output is correct
29 Correct 25 ms 24296 KB Output is correct
30 Correct 21 ms 24296 KB Output is correct
31 Correct 509 ms 33484 KB Output is correct
32 Correct 358 ms 33484 KB Output is correct
33 Correct 582 ms 33484 KB Output is correct
34 Correct 561 ms 33484 KB Output is correct
35 Correct 645 ms 33484 KB Output is correct
36 Correct 593 ms 33484 KB Output is correct
37 Correct 451 ms 33484 KB Output is correct
38 Correct 407 ms 33484 KB Output is correct
39 Correct 312 ms 33484 KB Output is correct
40 Correct 351 ms 33484 KB Output is correct
41 Correct 317 ms 33484 KB Output is correct
42 Correct 328 ms 33484 KB Output is correct
43 Correct 178 ms 33716 KB Output is correct
44 Correct 358 ms 33716 KB Output is correct
45 Correct 310 ms 33716 KB Output is correct
46 Correct 320 ms 33716 KB Output is correct
47 Correct 224 ms 33716 KB Output is correct
48 Correct 257 ms 33716 KB Output is correct
49 Correct 247 ms 33716 KB Output is correct
50 Correct 268 ms 33716 KB Output is correct
51 Correct 247 ms 33716 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2380 ms 71432 KB Output is correct
2 Correct 3553 ms 71432 KB Output is correct
3 Correct 1368 ms 71432 KB Output is correct
4 Correct 1963 ms 71432 KB Output is correct
5 Correct 3472 ms 71432 KB Output is correct
6 Correct 3676 ms 71432 KB Output is correct
7 Correct 1274 ms 71432 KB Output is correct
8 Correct 1681 ms 71432 KB Output is correct
9 Correct 1980 ms 71432 KB Output is correct
10 Correct 2451 ms 71432 KB Output is correct
11 Correct 1715 ms 71432 KB Output is correct
12 Correct 1825 ms 71432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2946 ms 71432 KB Output is correct
2 Correct 1925 ms 71432 KB Output is correct
3 Correct 3754 ms 71432 KB Output is correct
4 Correct 1440 ms 71432 KB Output is correct
5 Correct 2323 ms 71432 KB Output is correct
6 Correct 2125 ms 71432 KB Output is correct
7 Correct 3913 ms 71432 KB Output is correct
8 Correct 4077 ms 71432 KB Output is correct
9 Correct 1766 ms 71432 KB Output is correct
10 Correct 2266 ms 71432 KB Output is correct
11 Correct 2674 ms 71432 KB Output is correct
12 Correct 2739 ms 71432 KB Output is correct
13 Correct 1592 ms 71432 KB Output is correct
14 Correct 1485 ms 71432 KB Output is correct
15 Correct 1893 ms 71432 KB Output is correct
16 Correct 1945 ms 71432 KB Output is correct
17 Correct 2096 ms 71432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 23800 KB Output is correct
2 Correct 24 ms 23908 KB Output is correct
3 Correct 21 ms 23984 KB Output is correct
4 Correct 20 ms 23984 KB Output is correct
5 Correct 22 ms 24020 KB Output is correct
6 Correct 22 ms 24036 KB Output is correct
7 Correct 22 ms 24088 KB Output is correct
8 Correct 22 ms 24088 KB Output is correct
9 Correct 22 ms 24144 KB Output is correct
10 Correct 26 ms 24180 KB Output is correct
11 Correct 28 ms 24184 KB Output is correct
12 Correct 27 ms 24184 KB Output is correct
13 Correct 24 ms 24184 KB Output is correct
14 Correct 25 ms 24184 KB Output is correct
15 Correct 25 ms 24184 KB Output is correct
16 Correct 24 ms 24196 KB Output is correct
17 Correct 25 ms 24196 KB Output is correct
18 Correct 24 ms 24196 KB Output is correct
19 Correct 28 ms 24196 KB Output is correct
20 Correct 27 ms 24196 KB Output is correct
21 Correct 26 ms 24196 KB Output is correct
22 Correct 26 ms 24196 KB Output is correct
23 Correct 23 ms 24196 KB Output is correct
24 Correct 22 ms 24296 KB Output is correct
25 Correct 21 ms 24296 KB Output is correct
26 Correct 24 ms 24296 KB Output is correct
27 Correct 22 ms 24296 KB Output is correct
28 Correct 26 ms 24296 KB Output is correct
29 Correct 25 ms 24296 KB Output is correct
30 Correct 21 ms 24296 KB Output is correct
31 Correct 509 ms 33484 KB Output is correct
32 Correct 358 ms 33484 KB Output is correct
33 Correct 582 ms 33484 KB Output is correct
34 Correct 561 ms 33484 KB Output is correct
35 Correct 645 ms 33484 KB Output is correct
36 Correct 593 ms 33484 KB Output is correct
37 Correct 451 ms 33484 KB Output is correct
38 Correct 407 ms 33484 KB Output is correct
39 Correct 312 ms 33484 KB Output is correct
40 Correct 351 ms 33484 KB Output is correct
41 Correct 317 ms 33484 KB Output is correct
42 Correct 328 ms 33484 KB Output is correct
43 Correct 178 ms 33716 KB Output is correct
44 Correct 358 ms 33716 KB Output is correct
45 Correct 310 ms 33716 KB Output is correct
46 Correct 320 ms 33716 KB Output is correct
47 Correct 224 ms 33716 KB Output is correct
48 Correct 257 ms 33716 KB Output is correct
49 Correct 247 ms 33716 KB Output is correct
50 Correct 268 ms 33716 KB Output is correct
51 Correct 247 ms 33716 KB Output is correct
52 Correct 306 ms 71432 KB Output is correct
53 Correct 329 ms 71432 KB Output is correct
54 Correct 342 ms 71432 KB Output is correct
55 Correct 330 ms 71432 KB Output is correct
56 Correct 313 ms 71432 KB Output is correct
57 Correct 460 ms 71432 KB Output is correct
58 Correct 398 ms 71432 KB Output is correct
59 Correct 308 ms 71432 KB Output is correct
60 Correct 341 ms 71432 KB Output is correct
61 Correct 143 ms 71432 KB Output is correct
62 Correct 244 ms 71432 KB Output is correct
63 Correct 293 ms 71432 KB Output is correct
64 Correct 314 ms 71432 KB Output is correct
65 Correct 308 ms 71432 KB Output is correct
66 Correct 332 ms 71432 KB Output is correct
67 Correct 373 ms 71432 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 23800 KB Output is correct
2 Correct 24 ms 23908 KB Output is correct
3 Correct 21 ms 23984 KB Output is correct
4 Correct 20 ms 23984 KB Output is correct
5 Correct 22 ms 24020 KB Output is correct
6 Correct 22 ms 24036 KB Output is correct
7 Correct 22 ms 24088 KB Output is correct
8 Correct 22 ms 24088 KB Output is correct
9 Correct 22 ms 24144 KB Output is correct
10 Correct 26 ms 24180 KB Output is correct
11 Correct 28 ms 24184 KB Output is correct
12 Correct 27 ms 24184 KB Output is correct
13 Correct 24 ms 24184 KB Output is correct
14 Correct 25 ms 24184 KB Output is correct
15 Correct 25 ms 24184 KB Output is correct
16 Correct 24 ms 24196 KB Output is correct
17 Correct 25 ms 24196 KB Output is correct
18 Correct 24 ms 24196 KB Output is correct
19 Correct 28 ms 24196 KB Output is correct
20 Correct 27 ms 24196 KB Output is correct
21 Correct 26 ms 24196 KB Output is correct
22 Correct 26 ms 24196 KB Output is correct
23 Correct 23 ms 24196 KB Output is correct
24 Correct 22 ms 24296 KB Output is correct
25 Correct 21 ms 24296 KB Output is correct
26 Correct 24 ms 24296 KB Output is correct
27 Correct 22 ms 24296 KB Output is correct
28 Correct 26 ms 24296 KB Output is correct
29 Correct 25 ms 24296 KB Output is correct
30 Correct 21 ms 24296 KB Output is correct
31 Correct 509 ms 33484 KB Output is correct
32 Correct 358 ms 33484 KB Output is correct
33 Correct 582 ms 33484 KB Output is correct
34 Correct 561 ms 33484 KB Output is correct
35 Correct 645 ms 33484 KB Output is correct
36 Correct 593 ms 33484 KB Output is correct
37 Correct 451 ms 33484 KB Output is correct
38 Correct 407 ms 33484 KB Output is correct
39 Correct 312 ms 33484 KB Output is correct
40 Correct 351 ms 33484 KB Output is correct
41 Correct 317 ms 33484 KB Output is correct
42 Correct 328 ms 33484 KB Output is correct
43 Correct 178 ms 33716 KB Output is correct
44 Correct 358 ms 33716 KB Output is correct
45 Correct 310 ms 33716 KB Output is correct
46 Correct 320 ms 33716 KB Output is correct
47 Correct 224 ms 33716 KB Output is correct
48 Correct 257 ms 33716 KB Output is correct
49 Correct 247 ms 33716 KB Output is correct
50 Correct 268 ms 33716 KB Output is correct
51 Correct 247 ms 33716 KB Output is correct
52 Correct 2380 ms 71432 KB Output is correct
53 Correct 3553 ms 71432 KB Output is correct
54 Correct 1368 ms 71432 KB Output is correct
55 Correct 1963 ms 71432 KB Output is correct
56 Correct 3472 ms 71432 KB Output is correct
57 Correct 3676 ms 71432 KB Output is correct
58 Correct 1274 ms 71432 KB Output is correct
59 Correct 1681 ms 71432 KB Output is correct
60 Correct 1980 ms 71432 KB Output is correct
61 Correct 2451 ms 71432 KB Output is correct
62 Correct 1715 ms 71432 KB Output is correct
63 Correct 1825 ms 71432 KB Output is correct
64 Correct 2946 ms 71432 KB Output is correct
65 Correct 1925 ms 71432 KB Output is correct
66 Correct 3754 ms 71432 KB Output is correct
67 Correct 1440 ms 71432 KB Output is correct
68 Correct 2323 ms 71432 KB Output is correct
69 Correct 2125 ms 71432 KB Output is correct
70 Correct 3913 ms 71432 KB Output is correct
71 Correct 4077 ms 71432 KB Output is correct
72 Correct 1766 ms 71432 KB Output is correct
73 Correct 2266 ms 71432 KB Output is correct
74 Correct 2674 ms 71432 KB Output is correct
75 Correct 2739 ms 71432 KB Output is correct
76 Correct 1592 ms 71432 KB Output is correct
77 Correct 1485 ms 71432 KB Output is correct
78 Correct 1893 ms 71432 KB Output is correct
79 Correct 1945 ms 71432 KB Output is correct
80 Correct 2096 ms 71432 KB Output is correct
81 Correct 306 ms 71432 KB Output is correct
82 Correct 329 ms 71432 KB Output is correct
83 Correct 342 ms 71432 KB Output is correct
84 Correct 330 ms 71432 KB Output is correct
85 Correct 313 ms 71432 KB Output is correct
86 Correct 460 ms 71432 KB Output is correct
87 Correct 398 ms 71432 KB Output is correct
88 Correct 308 ms 71432 KB Output is correct
89 Correct 341 ms 71432 KB Output is correct
90 Correct 143 ms 71432 KB Output is correct
91 Correct 244 ms 71432 KB Output is correct
92 Correct 293 ms 71432 KB Output is correct
93 Correct 314 ms 71432 KB Output is correct
94 Correct 308 ms 71432 KB Output is correct
95 Correct 332 ms 71432 KB Output is correct
96 Correct 373 ms 71432 KB Output is correct
97 Correct 1661 ms 71432 KB Output is correct
98 Correct 2063 ms 71432 KB Output is correct
99 Correct 3569 ms 71432 KB Output is correct
100 Correct 1806 ms 71432 KB Output is correct
101 Correct 2722 ms 71432 KB Output is correct
102 Correct 4075 ms 71432 KB Output is correct
103 Correct 2500 ms 71432 KB Output is correct
104 Correct 2656 ms 71432 KB Output is correct
105 Correct 1855 ms 71432 KB Output is correct
106 Correct 2068 ms 71432 KB Output is correct
107 Correct 1966 ms 71432 KB Output is correct
108 Correct 1933 ms 71432 KB Output is correct
109 Correct 2082 ms 71432 KB Output is correct
110 Correct 1823 ms 71432 KB Output is correct
111 Correct 1897 ms 71432 KB Output is correct
112 Correct 2137 ms 71432 KB Output is correct
113 Correct 691 ms 71432 KB Output is correct
114 Correct 1752 ms 71432 KB Output is correct
115 Correct 2215 ms 71432 KB Output is correct
116 Correct 2247 ms 71432 KB Output is correct
117 Correct 2551 ms 71432 KB Output is correct
118 Correct 2196 ms 71432 KB Output is correct
119 Correct 1976 ms 71432 KB Output is correct
120 Correct 1022 ms 71432 KB Output is correct
121 Correct 1164 ms 71432 KB Output is correct
122 Correct 1215 ms 71432 KB Output is correct
123 Correct 1494 ms 71432 KB Output is correct
124 Correct 1461 ms 71432 KB Output is correct
125 Correct 1477 ms 71432 KB Output is correct
126 Correct 1503 ms 71432 KB Output is correct