#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define int long long
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define g0(a) get<0>(a)
#define g1(a) get<1>(a)
#define g2(a) get<2>(a)
#define g3(a) get<3>(a)
#define g4(a) get<4>(a)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
using db = double;
using ll = long long;
using ld = long double;
using ii = pair<int, int>;
using iii = tuple<int, int, int>;
using iiii = tuple<int, int, int, int>;
template<class key, class value = null_type, class cmp = less<key> >
using ordered_set = tree<key, value, cmp, rb_tree_tag, tree_order_statistics_node_update>;
int n, a, b, k, ans = LLONG_MAX, cur, u_a[200005], v_a[200005], l_a[200005], u_b[200005], v_b[200005], l_b[200005], lnk_a[200005], sz_a[200005], lnk_b[200005], sz_b[200005], pf_a[200005], pf_b[200005], f[200005], s[200005];
iii t_a[200005], t_b[200005];
vector<int> vec_a[200005], vec_b[200005];
vector<iii> upd_a[200005], upd_b[200005];
map<ii, int> freq;
int nc2(int n) {
return n * (n - 1) / 2;
}
int find(int x, int lnk[]) {
if (x == lnk[x]) return x;
return lnk[x] = find(lnk[x], lnk);
}
vector<iii> unite(int a, int b, int lnk[], int sz[], vector<int> vec[]) {
a = find(a, lnk);
b = find(b, lnk);
assert(a != b);
if (sz[b] > sz[a]) swap(a, b);
sz[a] += sz[b];
lnk[b] = a;
vector<iii> upds;
for (int i : vec[b]) {
upds.eb(i, b, a);
vec[a].pb(i);
}
return upds;
}
main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n >> a >> b >> k;
if (k == 0) {
cout << "0\n";
return 0;
}
for (int i = 1; i <= a; i++) {
cin >> u_a[i] >> v_a[i] >> l_a[i];
t_a[i] = mt(l_a[i], u_a[i], v_a[i]);
}
sort(t_a + 1, t_a + 1 + a);
for (int i = 1; i <= b; i++) {
cin >> u_b[i] >> v_b[i] >> l_b[i];
t_b[i] = mt(l_b[i], u_b[i], v_b[i]);
}
sort(t_b + 1, t_b + 1 + b);
for (int i = 1; i <= n; i++) {
lnk_a[i] = lnk_b[i] = i;
sz_a[i] = sz_b[i] = 1;
vec_a[i].pb(i);
vec_b[i].pb(i);
}
for (int i = 1; i <= a; i++) {
tie(l_a[i], u_a[i], v_a[i]) = t_a[i];
int x = 0;
if (find(u_a[i], lnk_a) != find(v_a[i], lnk_a)) {
x = sz_a[find(u_a[i], lnk_a)] * sz_a[find(v_a[i], lnk_a)];
upd_a[i] = unite(u_a[i], v_a[i], lnk_a, sz_a, vec_a);
}
pf_a[i] = pf_a[i - 1] + x;
}
for (int i = 1; i <= b; i++) {
tie(l_b[i], u_b[i], v_b[i]) = t_b[i];
int x = 0;
if (find(u_b[i], lnk_b) != find(v_b[i], lnk_b)) {
x = sz_b[find(u_b[i], lnk_b)] * sz_b[find(v_b[i], lnk_b)];
upd_b[i] = unite(u_b[i], v_b[i], lnk_b, sz_b, vec_b);
}
pf_b[i] = pf_b[i - 1] + x;
if (pf_b[i] >= k) {
ans = min(ans, l_b[i]);
}
}
for (int i = 1; i <= n; i++) {
s[i] = find(i, lnk_b);
f[i] = i;
freq[mp(f[i], s[i])]++;
}
for (int i = 1, ptr = b; i <= a; i++) {
// add edge i
for (auto [u, prv, c] : upd_a[i]) {
cur -= nc2(freq[mp(f[u], s[u])]);
freq[mp(f[u], s[u])]--;
cur += nc2(freq[mp(f[u], s[u])]);
f[u] = c;
cur -= nc2(freq[mp(f[u], s[u])]);
freq[mp(f[u], s[u])]++;
cur += nc2(freq[mp(f[u], s[u])]);
}
while (pf_a[i] + pf_b[ptr] - cur >= k && ptr >= 1) {
// remove edge ptr
for (auto [u, prv, c] : upd_b[ptr]) {
cur -= nc2(freq[mp(f[u], s[u])]);
freq[mp(f[u], s[u])]--;
cur += nc2(freq[mp(f[u], s[u])]);
s[u] = prv;
cur -= nc2(freq[mp(f[u], s[u])]);
freq[mp(f[u], s[u])]++;
cur += nc2(freq[mp(f[u], s[u])]);
}
ptr--;
}
if (pf_a[i] + pf_b[ptr] - cur >= k) {
ans = min(ans, l_a[i]);
} else if (ptr + 1 <= b) {
ans = min(ans, l_a[i] + l_b[ptr + 1]);
}
}
cout << (ans == LLONG_MAX ? -1 : ans) << '\n';
}
Compilation message
Main.cpp:57:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
57 | main() {
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
19156 KB |
Output is correct |
2 |
Correct |
9 ms |
19028 KB |
Output is correct |
3 |
Correct |
9 ms |
19156 KB |
Output is correct |
4 |
Correct |
10 ms |
19240 KB |
Output is correct |
5 |
Correct |
9 ms |
19156 KB |
Output is correct |
6 |
Correct |
77 ms |
34280 KB |
Output is correct |
7 |
Correct |
84 ms |
34404 KB |
Output is correct |
8 |
Correct |
146 ms |
48972 KB |
Output is correct |
9 |
Correct |
165 ms |
48936 KB |
Output is correct |
10 |
Correct |
146 ms |
49012 KB |
Output is correct |
11 |
Correct |
149 ms |
48944 KB |
Output is correct |
12 |
Correct |
10 ms |
19028 KB |
Output is correct |
13 |
Correct |
11 ms |
19440 KB |
Output is correct |
14 |
Correct |
13 ms |
19412 KB |
Output is correct |
15 |
Correct |
12 ms |
19132 KB |
Output is correct |
16 |
Correct |
150 ms |
49440 KB |
Output is correct |
17 |
Correct |
156 ms |
49484 KB |
Output is correct |
18 |
Correct |
156 ms |
49560 KB |
Output is correct |
19 |
Correct |
154 ms |
49500 KB |
Output is correct |
20 |
Correct |
152 ms |
49432 KB |
Output is correct |
21 |
Correct |
153 ms |
49612 KB |
Output is correct |
22 |
Correct |
163 ms |
49404 KB |
Output is correct |
23 |
Correct |
149 ms |
49208 KB |
Output is correct |
24 |
Correct |
10 ms |
19132 KB |
Output is correct |
25 |
Correct |
152 ms |
49476 KB |
Output is correct |
26 |
Correct |
156 ms |
49484 KB |
Output is correct |
27 |
Correct |
177 ms |
49464 KB |
Output is correct |
28 |
Correct |
148 ms |
49604 KB |
Output is correct |
29 |
Correct |
155 ms |
49420 KB |
Output is correct |
30 |
Correct |
160 ms |
49456 KB |
Output is correct |
31 |
Correct |
166 ms |
49328 KB |
Output is correct |
32 |
Correct |
159 ms |
49100 KB |
Output is correct |
33 |
Correct |
136 ms |
46700 KB |
Output is correct |
34 |
Correct |
143 ms |
46756 KB |
Output is correct |
35 |
Correct |
139 ms |
46712 KB |
Output is correct |
36 |
Correct |
136 ms |
46740 KB |
Output is correct |
37 |
Correct |
12 ms |
19796 KB |
Output is correct |
38 |
Correct |
12 ms |
19868 KB |
Output is correct |
39 |
Correct |
13 ms |
19748 KB |
Output is correct |
40 |
Correct |
12 ms |
19796 KB |
Output is correct |
41 |
Correct |
130 ms |
46568 KB |
Output is correct |
42 |
Correct |
134 ms |
46492 KB |
Output is correct |
43 |
Correct |
137 ms |
47852 KB |
Output is correct |
44 |
Correct |
139 ms |
47824 KB |
Output is correct |
45 |
Correct |
167 ms |
49448 KB |
Output is correct |
46 |
Correct |
160 ms |
49284 KB |
Output is correct |
47 |
Correct |
152 ms |
49076 KB |
Output is correct |
48 |
Correct |
140 ms |
46748 KB |
Output is correct |
49 |
Correct |
143 ms |
46616 KB |
Output is correct |
50 |
Correct |
14 ms |
20032 KB |
Output is correct |
51 |
Correct |
83 ms |
34508 KB |
Output is correct |
52 |
Correct |
81 ms |
34508 KB |
Output is correct |
53 |
Correct |
10 ms |
19124 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1064 ms |
106604 KB |
Output is correct |
2 |
Correct |
647 ms |
89860 KB |
Output is correct |
3 |
Correct |
645 ms |
90108 KB |
Output is correct |
4 |
Correct |
10 ms |
19120 KB |
Output is correct |
5 |
Correct |
10 ms |
19012 KB |
Output is correct |
6 |
Correct |
10 ms |
19128 KB |
Output is correct |
7 |
Correct |
123 ms |
46496 KB |
Output is correct |
8 |
Correct |
120 ms |
46832 KB |
Output is correct |
9 |
Correct |
220 ms |
77096 KB |
Output is correct |
10 |
Correct |
593 ms |
89892 KB |
Output is correct |
11 |
Correct |
480 ms |
97596 KB |
Output is correct |
12 |
Correct |
519 ms |
97680 KB |
Output is correct |
13 |
Correct |
474 ms |
97688 KB |
Output is correct |
14 |
Correct |
471 ms |
97744 KB |
Output is correct |
15 |
Correct |
10 ms |
19028 KB |
Output is correct |
16 |
Correct |
72 ms |
53528 KB |
Output is correct |
17 |
Correct |
72 ms |
53476 KB |
Output is correct |
18 |
Correct |
12 ms |
19156 KB |
Output is correct |
19 |
Correct |
1195 ms |
126528 KB |
Output is correct |
20 |
Correct |
1166 ms |
126004 KB |
Output is correct |
21 |
Correct |
1146 ms |
125916 KB |
Output is correct |
22 |
Correct |
1199 ms |
126788 KB |
Output is correct |
23 |
Correct |
1190 ms |
126188 KB |
Output is correct |
24 |
Correct |
1166 ms |
126860 KB |
Output is correct |
25 |
Correct |
1202 ms |
126176 KB |
Output is correct |
26 |
Correct |
1131 ms |
126016 KB |
Output is correct |
27 |
Correct |
690 ms |
113380 KB |
Output is correct |
28 |
Correct |
10 ms |
19156 KB |
Output is correct |
29 |
Correct |
1153 ms |
126532 KB |
Output is correct |
30 |
Correct |
1129 ms |
126708 KB |
Output is correct |
31 |
Correct |
1177 ms |
126148 KB |
Output is correct |
32 |
Correct |
1226 ms |
126356 KB |
Output is correct |
33 |
Correct |
1197 ms |
125868 KB |
Output is correct |
34 |
Correct |
1116 ms |
125012 KB |
Output is correct |
35 |
Correct |
1123 ms |
125384 KB |
Output is correct |
36 |
Correct |
1146 ms |
124868 KB |
Output is correct |
37 |
Correct |
691 ms |
112040 KB |
Output is correct |
38 |
Correct |
359 ms |
78368 KB |
Output is correct |
39 |
Correct |
366 ms |
78540 KB |
Output is correct |
40 |
Correct |
366 ms |
78248 KB |
Output is correct |
41 |
Correct |
374 ms |
78292 KB |
Output is correct |
42 |
Correct |
128 ms |
46500 KB |
Output is correct |
43 |
Correct |
122 ms |
46492 KB |
Output is correct |
44 |
Correct |
138 ms |
47868 KB |
Output is correct |
45 |
Correct |
153 ms |
47820 KB |
Output is correct |
46 |
Correct |
1174 ms |
126456 KB |
Output is correct |
47 |
Correct |
1225 ms |
126228 KB |
Output is correct |
48 |
Correct |
727 ms |
113792 KB |
Output is correct |
49 |
Correct |
1106 ms |
123452 KB |
Output is correct |
50 |
Correct |
866 ms |
115636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
19028 KB |
Output is correct |
2 |
Correct |
13 ms |
19124 KB |
Output is correct |
3 |
Correct |
69 ms |
32740 KB |
Output is correct |
4 |
Correct |
67 ms |
33000 KB |
Output is correct |
5 |
Correct |
981 ms |
106016 KB |
Output is correct |
6 |
Correct |
256 ms |
84576 KB |
Output is correct |
7 |
Correct |
248 ms |
83852 KB |
Output is correct |
8 |
Correct |
74 ms |
53580 KB |
Output is correct |
9 |
Correct |
196 ms |
76092 KB |
Output is correct |
10 |
Correct |
189 ms |
76144 KB |
Output is correct |
11 |
Correct |
208 ms |
76240 KB |
Output is correct |
12 |
Correct |
205 ms |
76056 KB |
Output is correct |
13 |
Correct |
10 ms |
19064 KB |
Output is correct |
14 |
Correct |
72 ms |
53636 KB |
Output is correct |
15 |
Correct |
86 ms |
53624 KB |
Output is correct |
16 |
Correct |
10 ms |
19156 KB |
Output is correct |
17 |
Correct |
1072 ms |
107396 KB |
Output is correct |
18 |
Correct |
1126 ms |
107496 KB |
Output is correct |
19 |
Correct |
1038 ms |
107508 KB |
Output is correct |
20 |
Correct |
1025 ms |
106892 KB |
Output is correct |
21 |
Correct |
1042 ms |
107484 KB |
Output is correct |
22 |
Correct |
769 ms |
100676 KB |
Output is correct |
23 |
Correct |
684 ms |
96916 KB |
Output is correct |
24 |
Correct |
411 ms |
89300 KB |
Output is correct |
25 |
Correct |
273 ms |
84220 KB |
Output is correct |
26 |
Correct |
11 ms |
19156 KB |
Output is correct |
27 |
Correct |
1018 ms |
107236 KB |
Output is correct |
28 |
Correct |
1014 ms |
107016 KB |
Output is correct |
29 |
Correct |
1010 ms |
107168 KB |
Output is correct |
30 |
Correct |
999 ms |
106716 KB |
Output is correct |
31 |
Correct |
992 ms |
107360 KB |
Output is correct |
32 |
Correct |
761 ms |
100520 KB |
Output is correct |
33 |
Correct |
622 ms |
95964 KB |
Output is correct |
34 |
Correct |
290 ms |
85484 KB |
Output is correct |
35 |
Correct |
244 ms |
84124 KB |
Output is correct |
36 |
Correct |
142 ms |
57144 KB |
Output is correct |
37 |
Correct |
139 ms |
57180 KB |
Output is correct |
38 |
Correct |
154 ms |
57136 KB |
Output is correct |
39 |
Correct |
136 ms |
57228 KB |
Output is correct |
40 |
Correct |
153 ms |
57348 KB |
Output is correct |
41 |
Correct |
141 ms |
57284 KB |
Output is correct |
42 |
Correct |
142 ms |
57336 KB |
Output is correct |
43 |
Correct |
138 ms |
57164 KB |
Output is correct |
44 |
Correct |
137 ms |
57344 KB |
Output is correct |
45 |
Correct |
136 ms |
57160 KB |
Output is correct |
46 |
Correct |
73 ms |
32888 KB |
Output is correct |
47 |
Correct |
67 ms |
32868 KB |
Output is correct |
48 |
Correct |
74 ms |
33592 KB |
Output is correct |
49 |
Correct |
72 ms |
33484 KB |
Output is correct |
50 |
Correct |
851 ms |
102800 KB |
Output is correct |
51 |
Correct |
338 ms |
86832 KB |
Output is correct |
52 |
Correct |
244 ms |
83924 KB |
Output is correct |
53 |
Correct |
964 ms |
105444 KB |
Output is correct |
54 |
Correct |
393 ms |
88600 KB |
Output is correct |
55 |
Correct |
172 ms |
67484 KB |
Output is correct |
56 |
Correct |
73 ms |
53516 KB |
Output is correct |
57 |
Correct |
77 ms |
53560 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
19156 KB |
Output is correct |
2 |
Correct |
9 ms |
19028 KB |
Output is correct |
3 |
Correct |
9 ms |
19156 KB |
Output is correct |
4 |
Correct |
10 ms |
19240 KB |
Output is correct |
5 |
Correct |
9 ms |
19156 KB |
Output is correct |
6 |
Correct |
77 ms |
34280 KB |
Output is correct |
7 |
Correct |
84 ms |
34404 KB |
Output is correct |
8 |
Correct |
146 ms |
48972 KB |
Output is correct |
9 |
Correct |
165 ms |
48936 KB |
Output is correct |
10 |
Correct |
146 ms |
49012 KB |
Output is correct |
11 |
Correct |
149 ms |
48944 KB |
Output is correct |
12 |
Correct |
10 ms |
19028 KB |
Output is correct |
13 |
Correct |
11 ms |
19440 KB |
Output is correct |
14 |
Correct |
13 ms |
19412 KB |
Output is correct |
15 |
Correct |
12 ms |
19132 KB |
Output is correct |
16 |
Correct |
150 ms |
49440 KB |
Output is correct |
17 |
Correct |
156 ms |
49484 KB |
Output is correct |
18 |
Correct |
156 ms |
49560 KB |
Output is correct |
19 |
Correct |
154 ms |
49500 KB |
Output is correct |
20 |
Correct |
152 ms |
49432 KB |
Output is correct |
21 |
Correct |
153 ms |
49612 KB |
Output is correct |
22 |
Correct |
163 ms |
49404 KB |
Output is correct |
23 |
Correct |
149 ms |
49208 KB |
Output is correct |
24 |
Correct |
10 ms |
19132 KB |
Output is correct |
25 |
Correct |
152 ms |
49476 KB |
Output is correct |
26 |
Correct |
156 ms |
49484 KB |
Output is correct |
27 |
Correct |
177 ms |
49464 KB |
Output is correct |
28 |
Correct |
148 ms |
49604 KB |
Output is correct |
29 |
Correct |
155 ms |
49420 KB |
Output is correct |
30 |
Correct |
160 ms |
49456 KB |
Output is correct |
31 |
Correct |
166 ms |
49328 KB |
Output is correct |
32 |
Correct |
159 ms |
49100 KB |
Output is correct |
33 |
Correct |
136 ms |
46700 KB |
Output is correct |
34 |
Correct |
143 ms |
46756 KB |
Output is correct |
35 |
Correct |
139 ms |
46712 KB |
Output is correct |
36 |
Correct |
136 ms |
46740 KB |
Output is correct |
37 |
Correct |
12 ms |
19796 KB |
Output is correct |
38 |
Correct |
12 ms |
19868 KB |
Output is correct |
39 |
Correct |
13 ms |
19748 KB |
Output is correct |
40 |
Correct |
12 ms |
19796 KB |
Output is correct |
41 |
Correct |
130 ms |
46568 KB |
Output is correct |
42 |
Correct |
134 ms |
46492 KB |
Output is correct |
43 |
Correct |
137 ms |
47852 KB |
Output is correct |
44 |
Correct |
139 ms |
47824 KB |
Output is correct |
45 |
Correct |
167 ms |
49448 KB |
Output is correct |
46 |
Correct |
160 ms |
49284 KB |
Output is correct |
47 |
Correct |
152 ms |
49076 KB |
Output is correct |
48 |
Correct |
140 ms |
46748 KB |
Output is correct |
49 |
Correct |
143 ms |
46616 KB |
Output is correct |
50 |
Correct |
14 ms |
20032 KB |
Output is correct |
51 |
Correct |
83 ms |
34508 KB |
Output is correct |
52 |
Correct |
81 ms |
34508 KB |
Output is correct |
53 |
Correct |
10 ms |
19124 KB |
Output is correct |
54 |
Correct |
1064 ms |
106604 KB |
Output is correct |
55 |
Correct |
647 ms |
89860 KB |
Output is correct |
56 |
Correct |
645 ms |
90108 KB |
Output is correct |
57 |
Correct |
10 ms |
19120 KB |
Output is correct |
58 |
Correct |
10 ms |
19012 KB |
Output is correct |
59 |
Correct |
10 ms |
19128 KB |
Output is correct |
60 |
Correct |
123 ms |
46496 KB |
Output is correct |
61 |
Correct |
120 ms |
46832 KB |
Output is correct |
62 |
Correct |
220 ms |
77096 KB |
Output is correct |
63 |
Correct |
593 ms |
89892 KB |
Output is correct |
64 |
Correct |
480 ms |
97596 KB |
Output is correct |
65 |
Correct |
519 ms |
97680 KB |
Output is correct |
66 |
Correct |
474 ms |
97688 KB |
Output is correct |
67 |
Correct |
471 ms |
97744 KB |
Output is correct |
68 |
Correct |
10 ms |
19028 KB |
Output is correct |
69 |
Correct |
72 ms |
53528 KB |
Output is correct |
70 |
Correct |
72 ms |
53476 KB |
Output is correct |
71 |
Correct |
12 ms |
19156 KB |
Output is correct |
72 |
Correct |
1195 ms |
126528 KB |
Output is correct |
73 |
Correct |
1166 ms |
126004 KB |
Output is correct |
74 |
Correct |
1146 ms |
125916 KB |
Output is correct |
75 |
Correct |
1199 ms |
126788 KB |
Output is correct |
76 |
Correct |
1190 ms |
126188 KB |
Output is correct |
77 |
Correct |
1166 ms |
126860 KB |
Output is correct |
78 |
Correct |
1202 ms |
126176 KB |
Output is correct |
79 |
Correct |
1131 ms |
126016 KB |
Output is correct |
80 |
Correct |
690 ms |
113380 KB |
Output is correct |
81 |
Correct |
10 ms |
19156 KB |
Output is correct |
82 |
Correct |
1153 ms |
126532 KB |
Output is correct |
83 |
Correct |
1129 ms |
126708 KB |
Output is correct |
84 |
Correct |
1177 ms |
126148 KB |
Output is correct |
85 |
Correct |
1226 ms |
126356 KB |
Output is correct |
86 |
Correct |
1197 ms |
125868 KB |
Output is correct |
87 |
Correct |
1116 ms |
125012 KB |
Output is correct |
88 |
Correct |
1123 ms |
125384 KB |
Output is correct |
89 |
Correct |
1146 ms |
124868 KB |
Output is correct |
90 |
Correct |
691 ms |
112040 KB |
Output is correct |
91 |
Correct |
359 ms |
78368 KB |
Output is correct |
92 |
Correct |
366 ms |
78540 KB |
Output is correct |
93 |
Correct |
366 ms |
78248 KB |
Output is correct |
94 |
Correct |
374 ms |
78292 KB |
Output is correct |
95 |
Correct |
128 ms |
46500 KB |
Output is correct |
96 |
Correct |
122 ms |
46492 KB |
Output is correct |
97 |
Correct |
138 ms |
47868 KB |
Output is correct |
98 |
Correct |
153 ms |
47820 KB |
Output is correct |
99 |
Correct |
1174 ms |
126456 KB |
Output is correct |
100 |
Correct |
1225 ms |
126228 KB |
Output is correct |
101 |
Correct |
727 ms |
113792 KB |
Output is correct |
102 |
Correct |
1106 ms |
123452 KB |
Output is correct |
103 |
Correct |
866 ms |
115636 KB |
Output is correct |
104 |
Correct |
10 ms |
19028 KB |
Output is correct |
105 |
Correct |
13 ms |
19124 KB |
Output is correct |
106 |
Correct |
69 ms |
32740 KB |
Output is correct |
107 |
Correct |
67 ms |
33000 KB |
Output is correct |
108 |
Correct |
981 ms |
106016 KB |
Output is correct |
109 |
Correct |
256 ms |
84576 KB |
Output is correct |
110 |
Correct |
248 ms |
83852 KB |
Output is correct |
111 |
Correct |
74 ms |
53580 KB |
Output is correct |
112 |
Correct |
196 ms |
76092 KB |
Output is correct |
113 |
Correct |
189 ms |
76144 KB |
Output is correct |
114 |
Correct |
208 ms |
76240 KB |
Output is correct |
115 |
Correct |
205 ms |
76056 KB |
Output is correct |
116 |
Correct |
10 ms |
19064 KB |
Output is correct |
117 |
Correct |
72 ms |
53636 KB |
Output is correct |
118 |
Correct |
86 ms |
53624 KB |
Output is correct |
119 |
Correct |
10 ms |
19156 KB |
Output is correct |
120 |
Correct |
1072 ms |
107396 KB |
Output is correct |
121 |
Correct |
1126 ms |
107496 KB |
Output is correct |
122 |
Correct |
1038 ms |
107508 KB |
Output is correct |
123 |
Correct |
1025 ms |
106892 KB |
Output is correct |
124 |
Correct |
1042 ms |
107484 KB |
Output is correct |
125 |
Correct |
769 ms |
100676 KB |
Output is correct |
126 |
Correct |
684 ms |
96916 KB |
Output is correct |
127 |
Correct |
411 ms |
89300 KB |
Output is correct |
128 |
Correct |
273 ms |
84220 KB |
Output is correct |
129 |
Correct |
11 ms |
19156 KB |
Output is correct |
130 |
Correct |
1018 ms |
107236 KB |
Output is correct |
131 |
Correct |
1014 ms |
107016 KB |
Output is correct |
132 |
Correct |
1010 ms |
107168 KB |
Output is correct |
133 |
Correct |
999 ms |
106716 KB |
Output is correct |
134 |
Correct |
992 ms |
107360 KB |
Output is correct |
135 |
Correct |
761 ms |
100520 KB |
Output is correct |
136 |
Correct |
622 ms |
95964 KB |
Output is correct |
137 |
Correct |
290 ms |
85484 KB |
Output is correct |
138 |
Correct |
244 ms |
84124 KB |
Output is correct |
139 |
Correct |
142 ms |
57144 KB |
Output is correct |
140 |
Correct |
139 ms |
57180 KB |
Output is correct |
141 |
Correct |
154 ms |
57136 KB |
Output is correct |
142 |
Correct |
136 ms |
57228 KB |
Output is correct |
143 |
Correct |
153 ms |
57348 KB |
Output is correct |
144 |
Correct |
141 ms |
57284 KB |
Output is correct |
145 |
Correct |
142 ms |
57336 KB |
Output is correct |
146 |
Correct |
138 ms |
57164 KB |
Output is correct |
147 |
Correct |
137 ms |
57344 KB |
Output is correct |
148 |
Correct |
136 ms |
57160 KB |
Output is correct |
149 |
Correct |
73 ms |
32888 KB |
Output is correct |
150 |
Correct |
67 ms |
32868 KB |
Output is correct |
151 |
Correct |
74 ms |
33592 KB |
Output is correct |
152 |
Correct |
72 ms |
33484 KB |
Output is correct |
153 |
Correct |
851 ms |
102800 KB |
Output is correct |
154 |
Correct |
338 ms |
86832 KB |
Output is correct |
155 |
Correct |
244 ms |
83924 KB |
Output is correct |
156 |
Correct |
964 ms |
105444 KB |
Output is correct |
157 |
Correct |
393 ms |
88600 KB |
Output is correct |
158 |
Correct |
172 ms |
67484 KB |
Output is correct |
159 |
Correct |
73 ms |
53516 KB |
Output is correct |
160 |
Correct |
77 ms |
53560 KB |
Output is correct |
161 |
Correct |
12 ms |
19124 KB |
Output is correct |
162 |
Correct |
10 ms |
19156 KB |
Output is correct |
163 |
Correct |
145 ms |
46536 KB |
Output is correct |
164 |
Correct |
126 ms |
46848 KB |
Output is correct |
165 |
Correct |
252 ms |
84096 KB |
Output is correct |
166 |
Correct |
1000 ms |
107220 KB |
Output is correct |
167 |
Correct |
786 ms |
111160 KB |
Output is correct |
168 |
Correct |
799 ms |
111216 KB |
Output is correct |
169 |
Correct |
761 ms |
111516 KB |
Output is correct |
170 |
Correct |
748 ms |
111140 KB |
Output is correct |
171 |
Correct |
10 ms |
19028 KB |
Output is correct |
172 |
Correct |
72 ms |
53544 KB |
Output is correct |
173 |
Correct |
74 ms |
53668 KB |
Output is correct |
174 |
Correct |
11 ms |
19132 KB |
Output is correct |
175 |
Correct |
2134 ms |
160292 KB |
Output is correct |
176 |
Correct |
2017 ms |
161184 KB |
Output is correct |
177 |
Correct |
2039 ms |
159956 KB |
Output is correct |
178 |
Correct |
2107 ms |
161284 KB |
Output is correct |
179 |
Correct |
2048 ms |
160772 KB |
Output is correct |
180 |
Correct |
2079 ms |
160528 KB |
Output is correct |
181 |
Correct |
2116 ms |
160156 KB |
Output is correct |
182 |
Correct |
2021 ms |
154496 KB |
Output is correct |
183 |
Correct |
1016 ms |
119176 KB |
Output is correct |
184 |
Correct |
11 ms |
19156 KB |
Output is correct |
185 |
Correct |
2278 ms |
160308 KB |
Output is correct |
186 |
Correct |
2215 ms |
159972 KB |
Output is correct |
187 |
Correct |
2253 ms |
160700 KB |
Output is correct |
188 |
Correct |
2021 ms |
160588 KB |
Output is correct |
189 |
Correct |
2068 ms |
159748 KB |
Output is correct |
190 |
Correct |
2012 ms |
159448 KB |
Output is correct |
191 |
Correct |
2073 ms |
158436 KB |
Output is correct |
192 |
Correct |
1687 ms |
139344 KB |
Output is correct |
193 |
Correct |
899 ms |
118340 KB |
Output is correct |
194 |
Correct |
507 ms |
83444 KB |
Output is correct |
195 |
Correct |
563 ms |
84768 KB |
Output is correct |
196 |
Correct |
528 ms |
84696 KB |
Output is correct |
197 |
Correct |
509 ms |
84620 KB |
Output is correct |
198 |
Correct |
519 ms |
85008 KB |
Output is correct |
199 |
Correct |
510 ms |
84804 KB |
Output is correct |
200 |
Correct |
534 ms |
85184 KB |
Output is correct |
201 |
Correct |
503 ms |
84988 KB |
Output is correct |
202 |
Correct |
552 ms |
85044 KB |
Output is correct |
203 |
Correct |
127 ms |
46540 KB |
Output is correct |
204 |
Correct |
124 ms |
46520 KB |
Output is correct |
205 |
Correct |
161 ms |
47964 KB |
Output is correct |
206 |
Correct |
144 ms |
47816 KB |
Output is correct |
207 |
Correct |
2137 ms |
160828 KB |
Output is correct |
208 |
Correct |
1924 ms |
146088 KB |
Output is correct |
209 |
Correct |
1061 ms |
119476 KB |
Output is correct |
210 |
Correct |
2234 ms |
158424 KB |
Output is correct |
211 |
Correct |
1002 ms |
117008 KB |
Output is correct |
212 |
Correct |
611 ms |
90524 KB |
Output is correct |
213 |
Correct |
1057 ms |
107612 KB |
Output is correct |
214 |
Correct |
1004 ms |
106596 KB |
Output is correct |