Submission #810444

# Submission time Handle Problem Language Result Execution time Memory
810444 2023-08-06T09:50:07 Z qwerasdfzxcl Security Guard (JOI23_guard) C++17
100 / 100
559 ms 127148 KB
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
 
int n, mn, mx;
ll a[200200];
pair<int, int> E[400400];
 
ll ans[200200];
 
priority_queue<array<ll, 4>, vector<array<ll, 4>>, greater<array<ll, 4>>> pq;
 
struct DSU{
	int path[200200], valid[200200], n;
	priority_queue<pair<ll, int>, vector<pair<ll, int>>, greater<pair<ll, int>>> pq2[200200];
 
	void init(int N){
		n = N;
		for (int i=1;i<=n;i++){
			path[i] = i;
			valid[i] = 1;
		}
	}
 
	void reset(int x){valid[x] = 0;}
 
	void push(int x, int y){
		pq2[x].emplace(a[x]+a[y], y);
		pq2[y].emplace(a[x]+a[y], x);
	}
 
	void init2(){
		for (int i=1;i<=n;i++) if (valid[i] && !pq2[i].empty()){
			auto [cst, v] = pq2[i].top();
			pq.push({cst - a[i] - a[mn], cst, v, i});
		}
	}
 
	int find(int s){
		if (path[s]==s) return s;
		return path[s] = find(path[s]);
	}
 
	void merge(int s, int v){
		s = find(s), v = find(v);
		assert(s!=v);
 
		path[v] = s;
		if (!valid[s]) return;
 
		if (pq2[s].size() < pq2[v].size()) swap(pq2[s], pq2[v]);
		while(!pq2[v].empty()){
			pq2[s].push(pq2[v].top()); pq2[v].pop();
		}
 
		while(!pq2[s].empty() && find(pq2[s].top().second)==s) pq2[s].pop();
		if (!pq2[s].empty()){
			auto [cst, nxt] = pq2[s].top();
			pq.push({cst - a[s] - a[mn], cst, nxt, s});
		} 
 
	}
}dsu;
 
bool valid(const array<ll, 4> &p){
	if (dsu.find(p[2]) == dsu.find(p[3])) return 0;
	if (!dsu.valid[dsu.find(p[3])]) return 0;
	return p[1] - a[mn] - a[dsu.find(p[3])] == p[0];
}
 
int main(){
	int n, m, q;
	scanf("%d %d %d", &n, &m, &q);
	for (int i=1;i<=n;i++) scanf("%lld", a+i);
	for (int i=1;i<=m;i++){
		int x, y;
		scanf("%d %d", &x, &y);
		E[i] = {x, y};
	}
 
	mn = min_element(a+1, a+n+1) - a;
	mx = max_element(a+1, a+n+1) - a;
	dsu.init(n);
 
	int sz = n-1;
 
	for (int i=1;i<=m;i++){
		if (E[i].first==mn || E[i].second==mn){
			if (E[i].second==mn) swap(E[i].first, E[i].second);
			dsu.reset(E[i].second);
			sz--;
		}
 
		else{
			dsu.push(E[i].first, E[i].second);
		}
	}
 
	dsu.init2();
 
	for (int i=1;i<=n;i++) ans[sz] += a[i];
	ans[sz] += a[mn] * (n-2);
 
	for (int i=sz-1;i>=0;i--){
		while(!pq.empty() && !valid(pq.top())) pq.pop();
		assert(!pq.empty());
		auto [cst, _, u, v] = pq.top(); pq.pop();
 
		dsu.merge(u, v);
		ans[i] = ans[i+1] + cst;
	}
 
	ll ofs = a[mx];
	for (int i=1;i<=n;i++) ofs -= a[i];
 
	for (int i=0;i<=q;i++) printf("%lld\n", ans[min(i, sz)] + ofs);
}

Compilation message

guard.cpp: In function 'int main()':
guard.cpp:74:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   74 |  scanf("%d %d %d", &n, &m, &q);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
guard.cpp:75:30: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   75 |  for (int i=1;i<=n;i++) scanf("%lld", a+i);
      |                         ~~~~~^~~~~~~~~~~~~
guard.cpp:78:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   78 |   scanf("%d %d", &x, &y);
      |   ~~~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 6484 KB Output is correct
2 Correct 92 ms 28912 KB Output is correct
3 Correct 92 ms 28900 KB Output is correct
4 Correct 161 ms 35136 KB Output is correct
5 Correct 157 ms 35148 KB Output is correct
6 Correct 159 ms 35144 KB Output is correct
7 Correct 164 ms 35228 KB Output is correct
8 Correct 3 ms 6484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 6484 KB Output is correct
2 Correct 92 ms 28912 KB Output is correct
3 Correct 92 ms 28900 KB Output is correct
4 Correct 161 ms 35136 KB Output is correct
5 Correct 157 ms 35148 KB Output is correct
6 Correct 159 ms 35144 KB Output is correct
7 Correct 164 ms 35228 KB Output is correct
8 Correct 3 ms 6484 KB Output is correct
9 Correct 3 ms 6484 KB Output is correct
10 Correct 248 ms 35732 KB Output is correct
11 Correct 94 ms 28916 KB Output is correct
12 Correct 94 ms 28912 KB Output is correct
13 Correct 92 ms 28992 KB Output is correct
14 Correct 237 ms 35692 KB Output is correct
15 Correct 227 ms 35736 KB Output is correct
16 Correct 238 ms 35684 KB Output is correct
17 Correct 249 ms 35824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 6484 KB Output is correct
2 Correct 92 ms 28912 KB Output is correct
3 Correct 92 ms 28900 KB Output is correct
4 Correct 161 ms 35136 KB Output is correct
5 Correct 157 ms 35148 KB Output is correct
6 Correct 159 ms 35144 KB Output is correct
7 Correct 164 ms 35228 KB Output is correct
8 Correct 3 ms 6484 KB Output is correct
9 Correct 3 ms 6484 KB Output is correct
10 Correct 248 ms 35732 KB Output is correct
11 Correct 94 ms 28916 KB Output is correct
12 Correct 94 ms 28912 KB Output is correct
13 Correct 92 ms 28992 KB Output is correct
14 Correct 237 ms 35692 KB Output is correct
15 Correct 227 ms 35736 KB Output is correct
16 Correct 238 ms 35684 KB Output is correct
17 Correct 249 ms 35824 KB Output is correct
18 Correct 3 ms 6484 KB Output is correct
19 Correct 287 ms 36088 KB Output is correct
20 Correct 297 ms 36288 KB Output is correct
21 Correct 308 ms 35876 KB Output is correct
22 Correct 305 ms 36152 KB Output is correct
23 Correct 295 ms 35084 KB Output is correct
24 Correct 280 ms 33860 KB Output is correct
25 Correct 199 ms 29992 KB Output is correct
26 Correct 182 ms 28972 KB Output is correct
27 Correct 134 ms 29008 KB Output is correct
28 Correct 290 ms 34544 KB Output is correct
29 Correct 293 ms 32948 KB Output is correct
30 Correct 227 ms 29852 KB Output is correct
31 Correct 139 ms 28992 KB Output is correct
32 Correct 277 ms 36032 KB Output is correct
33 Correct 292 ms 33360 KB Output is correct
34 Correct 315 ms 72620 KB Output is correct
35 Correct 280 ms 68552 KB Output is correct
36 Correct 211 ms 51288 KB Output is correct
37 Correct 207 ms 47152 KB Output is correct
38 Correct 252 ms 30600 KB Output is correct
39 Correct 143 ms 29240 KB Output is correct
40 Correct 218 ms 29676 KB Output is correct
41 Correct 149 ms 29972 KB Output is correct
42 Correct 286 ms 36904 KB Output is correct
43 Correct 320 ms 34564 KB Output is correct
44 Correct 295 ms 39100 KB Output is correct
45 Correct 331 ms 38712 KB Output is correct
46 Correct 328 ms 37452 KB Output is correct
47 Correct 336 ms 39048 KB Output is correct
48 Correct 320 ms 39200 KB Output is correct
49 Correct 160 ms 32120 KB Output is correct
50 Correct 288 ms 36344 KB Output is correct
51 Correct 344 ms 40252 KB Output is correct
52 Correct 331 ms 37920 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 6484 KB Output is correct
2 Correct 92 ms 28912 KB Output is correct
3 Correct 92 ms 28900 KB Output is correct
4 Correct 161 ms 35136 KB Output is correct
5 Correct 157 ms 35148 KB Output is correct
6 Correct 159 ms 35144 KB Output is correct
7 Correct 164 ms 35228 KB Output is correct
8 Correct 3 ms 6484 KB Output is correct
9 Correct 3 ms 6484 KB Output is correct
10 Correct 248 ms 35732 KB Output is correct
11 Correct 94 ms 28916 KB Output is correct
12 Correct 94 ms 28912 KB Output is correct
13 Correct 92 ms 28992 KB Output is correct
14 Correct 237 ms 35692 KB Output is correct
15 Correct 227 ms 35736 KB Output is correct
16 Correct 238 ms 35684 KB Output is correct
17 Correct 249 ms 35824 KB Output is correct
18 Correct 3 ms 6484 KB Output is correct
19 Correct 287 ms 36088 KB Output is correct
20 Correct 297 ms 36288 KB Output is correct
21 Correct 308 ms 35876 KB Output is correct
22 Correct 305 ms 36152 KB Output is correct
23 Correct 295 ms 35084 KB Output is correct
24 Correct 280 ms 33860 KB Output is correct
25 Correct 199 ms 29992 KB Output is correct
26 Correct 182 ms 28972 KB Output is correct
27 Correct 134 ms 29008 KB Output is correct
28 Correct 290 ms 34544 KB Output is correct
29 Correct 293 ms 32948 KB Output is correct
30 Correct 227 ms 29852 KB Output is correct
31 Correct 139 ms 28992 KB Output is correct
32 Correct 277 ms 36032 KB Output is correct
33 Correct 292 ms 33360 KB Output is correct
34 Correct 315 ms 72620 KB Output is correct
35 Correct 280 ms 68552 KB Output is correct
36 Correct 211 ms 51288 KB Output is correct
37 Correct 207 ms 47152 KB Output is correct
38 Correct 252 ms 30600 KB Output is correct
39 Correct 143 ms 29240 KB Output is correct
40 Correct 218 ms 29676 KB Output is correct
41 Correct 149 ms 29972 KB Output is correct
42 Correct 286 ms 36904 KB Output is correct
43 Correct 320 ms 34564 KB Output is correct
44 Correct 295 ms 39100 KB Output is correct
45 Correct 331 ms 38712 KB Output is correct
46 Correct 328 ms 37452 KB Output is correct
47 Correct 336 ms 39048 KB Output is correct
48 Correct 320 ms 39200 KB Output is correct
49 Correct 160 ms 32120 KB Output is correct
50 Correct 288 ms 36344 KB Output is correct
51 Correct 344 ms 40252 KB Output is correct
52 Correct 331 ms 37920 KB Output is correct
53 Correct 3 ms 6484 KB Output is correct
54 Correct 334 ms 41988 KB Output is correct
55 Correct 314 ms 41604 KB Output is correct
56 Correct 369 ms 51772 KB Output is correct
57 Correct 530 ms 76060 KB Output is correct
58 Correct 510 ms 86456 KB Output is correct
59 Correct 421 ms 58864 KB Output is correct
60 Correct 287 ms 43824 KB Output is correct
61 Correct 273 ms 52528 KB Output is correct
62 Correct 250 ms 45980 KB Output is correct
63 Correct 311 ms 40412 KB Output is correct
64 Correct 309 ms 44560 KB Output is correct
65 Correct 320 ms 44800 KB Output is correct
66 Correct 219 ms 45104 KB Output is correct
67 Correct 421 ms 63508 KB Output is correct
68 Correct 313 ms 35260 KB Output is correct
69 Correct 510 ms 126468 KB Output is correct
70 Correct 311 ms 76580 KB Output is correct
71 Correct 208 ms 54988 KB Output is correct
72 Correct 209 ms 52900 KB Output is correct
73 Correct 241 ms 34948 KB Output is correct
74 Correct 187 ms 30236 KB Output is correct
75 Correct 215 ms 33896 KB Output is correct
76 Correct 149 ms 33640 KB Output is correct
77 Correct 276 ms 40172 KB Output is correct
78 Correct 354 ms 41328 KB Output is correct
79 Correct 451 ms 65308 KB Output is correct
80 Correct 424 ms 46468 KB Output is correct
81 Correct 511 ms 61648 KB Output is correct
82 Correct 533 ms 67932 KB Output is correct
83 Correct 515 ms 65524 KB Output is correct
84 Correct 282 ms 44164 KB Output is correct
85 Correct 305 ms 34668 KB Output is correct
86 Correct 369 ms 39732 KB Output is correct
87 Correct 353 ms 39288 KB Output is correct
88 Correct 536 ms 82368 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 6484 KB Output is correct
2 Correct 3 ms 6484 KB Output is correct
3 Correct 3 ms 6484 KB Output is correct
4 Correct 3 ms 6484 KB Output is correct
5 Correct 3 ms 6484 KB Output is correct
6 Correct 4 ms 6484 KB Output is correct
7 Correct 3 ms 6484 KB Output is correct
8 Correct 19 ms 8768 KB Output is correct
9 Correct 19 ms 8804 KB Output is correct
10 Correct 19 ms 8616 KB Output is correct
11 Correct 18 ms 8744 KB Output is correct
12 Correct 21 ms 8784 KB Output is correct
13 Correct 19 ms 8776 KB Output is correct
14 Correct 18 ms 8820 KB Output is correct
15 Correct 19 ms 8764 KB Output is correct
16 Correct 19 ms 8788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 6484 KB Output is correct
2 Correct 3 ms 6484 KB Output is correct
3 Correct 3 ms 6484 KB Output is correct
4 Correct 3 ms 6484 KB Output is correct
5 Correct 3 ms 6484 KB Output is correct
6 Correct 4 ms 6484 KB Output is correct
7 Correct 3 ms 6484 KB Output is correct
8 Correct 19 ms 8768 KB Output is correct
9 Correct 19 ms 8804 KB Output is correct
10 Correct 19 ms 8616 KB Output is correct
11 Correct 18 ms 8744 KB Output is correct
12 Correct 21 ms 8784 KB Output is correct
13 Correct 19 ms 8776 KB Output is correct
14 Correct 18 ms 8820 KB Output is correct
15 Correct 19 ms 8764 KB Output is correct
16 Correct 19 ms 8788 KB Output is correct
17 Correct 35 ms 12372 KB Output is correct
18 Correct 34 ms 12364 KB Output is correct
19 Correct 69 ms 19188 KB Output is correct
20 Correct 123 ms 29568 KB Output is correct
21 Correct 162 ms 35268 KB Output is correct
22 Correct 104 ms 23168 KB Output is correct
23 Correct 107 ms 34088 KB Output is correct
24 Correct 137 ms 30852 KB Output is correct
25 Correct 26 ms 9256 KB Output is correct
26 Correct 143 ms 35972 KB Output is correct
27 Correct 41 ms 14892 KB Output is correct
28 Correct 22 ms 9276 KB Output is correct
29 Correct 21 ms 9156 KB Output is correct
30 Correct 31 ms 9200 KB Output is correct
31 Correct 20 ms 8052 KB Output is correct
32 Correct 22 ms 8100 KB Output is correct
33 Correct 28 ms 9676 KB Output is correct
34 Correct 28 ms 10280 KB Output is correct
35 Correct 75 ms 21496 KB Output is correct
36 Correct 185 ms 49248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 6484 KB Output is correct
2 Correct 92 ms 28912 KB Output is correct
3 Correct 92 ms 28900 KB Output is correct
4 Correct 161 ms 35136 KB Output is correct
5 Correct 157 ms 35148 KB Output is correct
6 Correct 159 ms 35144 KB Output is correct
7 Correct 164 ms 35228 KB Output is correct
8 Correct 3 ms 6484 KB Output is correct
9 Correct 3 ms 6484 KB Output is correct
10 Correct 248 ms 35732 KB Output is correct
11 Correct 94 ms 28916 KB Output is correct
12 Correct 94 ms 28912 KB Output is correct
13 Correct 92 ms 28992 KB Output is correct
14 Correct 237 ms 35692 KB Output is correct
15 Correct 227 ms 35736 KB Output is correct
16 Correct 238 ms 35684 KB Output is correct
17 Correct 249 ms 35824 KB Output is correct
18 Correct 3 ms 6484 KB Output is correct
19 Correct 287 ms 36088 KB Output is correct
20 Correct 297 ms 36288 KB Output is correct
21 Correct 308 ms 35876 KB Output is correct
22 Correct 305 ms 36152 KB Output is correct
23 Correct 295 ms 35084 KB Output is correct
24 Correct 280 ms 33860 KB Output is correct
25 Correct 199 ms 29992 KB Output is correct
26 Correct 182 ms 28972 KB Output is correct
27 Correct 134 ms 29008 KB Output is correct
28 Correct 290 ms 34544 KB Output is correct
29 Correct 293 ms 32948 KB Output is correct
30 Correct 227 ms 29852 KB Output is correct
31 Correct 139 ms 28992 KB Output is correct
32 Correct 277 ms 36032 KB Output is correct
33 Correct 292 ms 33360 KB Output is correct
34 Correct 315 ms 72620 KB Output is correct
35 Correct 280 ms 68552 KB Output is correct
36 Correct 211 ms 51288 KB Output is correct
37 Correct 207 ms 47152 KB Output is correct
38 Correct 252 ms 30600 KB Output is correct
39 Correct 143 ms 29240 KB Output is correct
40 Correct 218 ms 29676 KB Output is correct
41 Correct 149 ms 29972 KB Output is correct
42 Correct 286 ms 36904 KB Output is correct
43 Correct 320 ms 34564 KB Output is correct
44 Correct 295 ms 39100 KB Output is correct
45 Correct 331 ms 38712 KB Output is correct
46 Correct 328 ms 37452 KB Output is correct
47 Correct 336 ms 39048 KB Output is correct
48 Correct 320 ms 39200 KB Output is correct
49 Correct 160 ms 32120 KB Output is correct
50 Correct 288 ms 36344 KB Output is correct
51 Correct 344 ms 40252 KB Output is correct
52 Correct 331 ms 37920 KB Output is correct
53 Correct 3 ms 6484 KB Output is correct
54 Correct 334 ms 41988 KB Output is correct
55 Correct 314 ms 41604 KB Output is correct
56 Correct 369 ms 51772 KB Output is correct
57 Correct 530 ms 76060 KB Output is correct
58 Correct 510 ms 86456 KB Output is correct
59 Correct 421 ms 58864 KB Output is correct
60 Correct 287 ms 43824 KB Output is correct
61 Correct 273 ms 52528 KB Output is correct
62 Correct 250 ms 45980 KB Output is correct
63 Correct 311 ms 40412 KB Output is correct
64 Correct 309 ms 44560 KB Output is correct
65 Correct 320 ms 44800 KB Output is correct
66 Correct 219 ms 45104 KB Output is correct
67 Correct 421 ms 63508 KB Output is correct
68 Correct 313 ms 35260 KB Output is correct
69 Correct 510 ms 126468 KB Output is correct
70 Correct 311 ms 76580 KB Output is correct
71 Correct 208 ms 54988 KB Output is correct
72 Correct 209 ms 52900 KB Output is correct
73 Correct 241 ms 34948 KB Output is correct
74 Correct 187 ms 30236 KB Output is correct
75 Correct 215 ms 33896 KB Output is correct
76 Correct 149 ms 33640 KB Output is correct
77 Correct 276 ms 40172 KB Output is correct
78 Correct 354 ms 41328 KB Output is correct
79 Correct 451 ms 65308 KB Output is correct
80 Correct 424 ms 46468 KB Output is correct
81 Correct 511 ms 61648 KB Output is correct
82 Correct 533 ms 67932 KB Output is correct
83 Correct 515 ms 65524 KB Output is correct
84 Correct 282 ms 44164 KB Output is correct
85 Correct 305 ms 34668 KB Output is correct
86 Correct 369 ms 39732 KB Output is correct
87 Correct 353 ms 39288 KB Output is correct
88 Correct 536 ms 82368 KB Output is correct
89 Correct 3 ms 6484 KB Output is correct
90 Correct 3 ms 6484 KB Output is correct
91 Correct 3 ms 6484 KB Output is correct
92 Correct 3 ms 6484 KB Output is correct
93 Correct 3 ms 6484 KB Output is correct
94 Correct 4 ms 6484 KB Output is correct
95 Correct 3 ms 6484 KB Output is correct
96 Correct 19 ms 8768 KB Output is correct
97 Correct 19 ms 8804 KB Output is correct
98 Correct 19 ms 8616 KB Output is correct
99 Correct 18 ms 8744 KB Output is correct
100 Correct 21 ms 8784 KB Output is correct
101 Correct 19 ms 8776 KB Output is correct
102 Correct 18 ms 8820 KB Output is correct
103 Correct 19 ms 8764 KB Output is correct
104 Correct 19 ms 8788 KB Output is correct
105 Correct 35 ms 12372 KB Output is correct
106 Correct 34 ms 12364 KB Output is correct
107 Correct 69 ms 19188 KB Output is correct
108 Correct 123 ms 29568 KB Output is correct
109 Correct 162 ms 35268 KB Output is correct
110 Correct 104 ms 23168 KB Output is correct
111 Correct 107 ms 34088 KB Output is correct
112 Correct 137 ms 30852 KB Output is correct
113 Correct 26 ms 9256 KB Output is correct
114 Correct 143 ms 35972 KB Output is correct
115 Correct 41 ms 14892 KB Output is correct
116 Correct 22 ms 9276 KB Output is correct
117 Correct 21 ms 9156 KB Output is correct
118 Correct 31 ms 9200 KB Output is correct
119 Correct 20 ms 8052 KB Output is correct
120 Correct 22 ms 8100 KB Output is correct
121 Correct 28 ms 9676 KB Output is correct
122 Correct 28 ms 10280 KB Output is correct
123 Correct 75 ms 21496 KB Output is correct
124 Correct 185 ms 49248 KB Output is correct
125 Correct 384 ms 46384 KB Output is correct
126 Correct 364 ms 45508 KB Output is correct
127 Correct 399 ms 54776 KB Output is correct
128 Correct 508 ms 71068 KB Output is correct
129 Correct 522 ms 65592 KB Output is correct
130 Correct 496 ms 69044 KB Output is correct
131 Correct 359 ms 51296 KB Output is correct
132 Correct 287 ms 45932 KB Output is correct
133 Correct 275 ms 44484 KB Output is correct
134 Correct 323 ms 44404 KB Output is correct
135 Correct 341 ms 44476 KB Output is correct
136 Correct 337 ms 49176 KB Output is correct
137 Correct 244 ms 48964 KB Output is correct
138 Correct 495 ms 66524 KB Output is correct
139 Correct 296 ms 37288 KB Output is correct
140 Correct 550 ms 127148 KB Output is correct
141 Correct 341 ms 77988 KB Output is correct
142 Correct 240 ms 57260 KB Output is correct
143 Correct 216 ms 53164 KB Output is correct
144 Correct 247 ms 37440 KB Output is correct
145 Correct 163 ms 35364 KB Output is correct
146 Correct 238 ms 33368 KB Output is correct
147 Correct 166 ms 35244 KB Output is correct
148 Correct 281 ms 41788 KB Output is correct
149 Correct 358 ms 40928 KB Output is correct
150 Correct 464 ms 73992 KB Output is correct
151 Correct 387 ms 50668 KB Output is correct
152 Correct 559 ms 74428 KB Output is correct
153 Correct 526 ms 70824 KB Output is correct
154 Correct 505 ms 75556 KB Output is correct
155 Correct 263 ms 51148 KB Output is correct
156 Correct 285 ms 39508 KB Output is correct
157 Correct 348 ms 43816 KB Output is correct
158 Correct 320 ms 40428 KB Output is correct
159 Correct 494 ms 87172 KB Output is correct