#include <bits/stdc++.h>
using namespace std;
#define Task "problemname"
#define int long long
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define foru(i, l, r) for(int i = l; i <= r; i++)
#define ford(i, r, l) for(int i = r; i >= l; i--)
#define __TIME (1.0 * clock() / CLOCKS_PER_SEC)
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
const int N = 4e3 + 5;
const int oo = 1e18, mod = 1e9 + 7;
int n, a, b, k, ans = oo, 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.pb({i, b, a});
vec[a].pb(i);
}
return upds;
}
void process() {
cin >> n >> a >> b >> k;
if (k == 0) {
cout << "0\n";
return;
}
for (int i = 1; i <= a; i++) {
cin >> u_a[i] >> v_a[i] >> l_a[i];
t_a[i] = make_tuple(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] = make_tuple(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 tmp : upd_a[i]) {
int u, prv, c;
tie(u, prv, c)=tmp;
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 tmp : upd_b[ptr]) {
int u, prv, c;
tie(u, prv, c)=tmp;
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 == oo ? -1 : ans) << '\n';
}
signed main() {
cin.tie(0)->sync_with_stdio(false);
if (fopen(Task".INP", "r")) {
freopen(Task".INP", "r", stdin);
freopen(Task".OUT", "w", stdout);
}
process();
cerr << "Time elapsed: " << __TIME << " s.\n";
return 0;
}
// dont stop
Compilation message
Main.cpp: In function 'int main()':
Main.cpp:139:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
139 | freopen(Task".INP", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:140:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
140 | freopen(Task".OUT", "w", stdout);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
43612 KB |
Output is correct |
2 |
Correct |
5 ms |
21084 KB |
Output is correct |
3 |
Correct |
6 ms |
31320 KB |
Output is correct |
4 |
Correct |
8 ms |
43612 KB |
Output is correct |
5 |
Correct |
7 ms |
43612 KB |
Output is correct |
6 |
Correct |
60 ms |
49152 KB |
Output is correct |
7 |
Correct |
62 ms |
46728 KB |
Output is correct |
8 |
Correct |
112 ms |
58004 KB |
Output is correct |
9 |
Correct |
141 ms |
57892 KB |
Output is correct |
10 |
Correct |
121 ms |
58060 KB |
Output is correct |
11 |
Correct |
112 ms |
57936 KB |
Output is correct |
12 |
Correct |
4 ms |
21084 KB |
Output is correct |
13 |
Correct |
7 ms |
33628 KB |
Output is correct |
14 |
Correct |
6 ms |
33700 KB |
Output is correct |
15 |
Correct |
5 ms |
21084 KB |
Output is correct |
16 |
Correct |
119 ms |
58524 KB |
Output is correct |
17 |
Correct |
142 ms |
58384 KB |
Output is correct |
18 |
Correct |
161 ms |
58448 KB |
Output is correct |
19 |
Correct |
144 ms |
58432 KB |
Output is correct |
20 |
Correct |
157 ms |
58452 KB |
Output is correct |
21 |
Correct |
134 ms |
58432 KB |
Output is correct |
22 |
Correct |
119 ms |
58460 KB |
Output is correct |
23 |
Correct |
154 ms |
58192 KB |
Output is correct |
24 |
Correct |
5 ms |
21084 KB |
Output is correct |
25 |
Correct |
116 ms |
58572 KB |
Output is correct |
26 |
Correct |
119 ms |
58388 KB |
Output is correct |
27 |
Correct |
120 ms |
58448 KB |
Output is correct |
28 |
Correct |
138 ms |
58324 KB |
Output is correct |
29 |
Correct |
119 ms |
58476 KB |
Output is correct |
30 |
Correct |
123 ms |
58456 KB |
Output is correct |
31 |
Correct |
117 ms |
58432 KB |
Output is correct |
32 |
Correct |
123 ms |
58192 KB |
Output is correct |
33 |
Correct |
114 ms |
55820 KB |
Output is correct |
34 |
Correct |
111 ms |
55744 KB |
Output is correct |
35 |
Correct |
120 ms |
55644 KB |
Output is correct |
36 |
Correct |
147 ms |
55636 KB |
Output is correct |
37 |
Correct |
11 ms |
44124 KB |
Output is correct |
38 |
Correct |
9 ms |
44120 KB |
Output is correct |
39 |
Correct |
9 ms |
44124 KB |
Output is correct |
40 |
Correct |
9 ms |
44120 KB |
Output is correct |
41 |
Correct |
99 ms |
55472 KB |
Output is correct |
42 |
Correct |
105 ms |
55504 KB |
Output is correct |
43 |
Correct |
110 ms |
56912 KB |
Output is correct |
44 |
Correct |
143 ms |
56880 KB |
Output is correct |
45 |
Correct |
121 ms |
58380 KB |
Output is correct |
46 |
Correct |
150 ms |
58192 KB |
Output is correct |
47 |
Correct |
114 ms |
58124 KB |
Output is correct |
48 |
Correct |
112 ms |
55648 KB |
Output is correct |
49 |
Correct |
117 ms |
55636 KB |
Output is correct |
50 |
Correct |
10 ms |
44376 KB |
Output is correct |
51 |
Correct |
69 ms |
50892 KB |
Output is correct |
52 |
Correct |
62 ms |
51592 KB |
Output is correct |
53 |
Correct |
8 ms |
43604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
873 ms |
114036 KB |
Output is correct |
2 |
Correct |
541 ms |
96780 KB |
Output is correct |
3 |
Correct |
530 ms |
97636 KB |
Output is correct |
4 |
Correct |
5 ms |
21084 KB |
Output is correct |
5 |
Correct |
5 ms |
21084 KB |
Output is correct |
6 |
Correct |
7 ms |
31324 KB |
Output is correct |
7 |
Correct |
100 ms |
55568 KB |
Output is correct |
8 |
Correct |
79 ms |
55896 KB |
Output is correct |
9 |
Correct |
155 ms |
83324 KB |
Output is correct |
10 |
Correct |
509 ms |
93124 KB |
Output is correct |
11 |
Correct |
476 ms |
97784 KB |
Output is correct |
12 |
Correct |
433 ms |
97792 KB |
Output is correct |
13 |
Correct |
465 ms |
97836 KB |
Output is correct |
14 |
Correct |
410 ms |
97804 KB |
Output is correct |
15 |
Correct |
4 ms |
21084 KB |
Output is correct |
16 |
Correct |
53 ms |
60496 KB |
Output is correct |
17 |
Correct |
52 ms |
60508 KB |
Output is correct |
18 |
Correct |
5 ms |
21080 KB |
Output is correct |
19 |
Correct |
1134 ms |
126464 KB |
Output is correct |
20 |
Correct |
1031 ms |
126196 KB |
Output is correct |
21 |
Correct |
1027 ms |
125980 KB |
Output is correct |
22 |
Correct |
1075 ms |
126836 KB |
Output is correct |
23 |
Correct |
972 ms |
126344 KB |
Output is correct |
24 |
Correct |
1018 ms |
126572 KB |
Output is correct |
25 |
Correct |
1117 ms |
126268 KB |
Output is correct |
26 |
Correct |
1064 ms |
125764 KB |
Output is correct |
27 |
Correct |
669 ms |
113684 KB |
Output is correct |
28 |
Correct |
5 ms |
21080 KB |
Output is correct |
29 |
Correct |
1020 ms |
126540 KB |
Output is correct |
30 |
Correct |
1127 ms |
126580 KB |
Output is correct |
31 |
Correct |
1066 ms |
126316 KB |
Output is correct |
32 |
Correct |
1139 ms |
126436 KB |
Output is correct |
33 |
Correct |
1012 ms |
125824 KB |
Output is correct |
34 |
Correct |
1033 ms |
125248 KB |
Output is correct |
35 |
Correct |
1052 ms |
125464 KB |
Output is correct |
36 |
Correct |
1058 ms |
124760 KB |
Output is correct |
37 |
Correct |
579 ms |
112340 KB |
Output is correct |
38 |
Correct |
298 ms |
82768 KB |
Output is correct |
39 |
Correct |
296 ms |
82588 KB |
Output is correct |
40 |
Correct |
352 ms |
82468 KB |
Output is correct |
41 |
Correct |
309 ms |
82976 KB |
Output is correct |
42 |
Correct |
100 ms |
55632 KB |
Output is correct |
43 |
Correct |
100 ms |
55636 KB |
Output is correct |
44 |
Correct |
109 ms |
56840 KB |
Output is correct |
45 |
Correct |
114 ms |
56936 KB |
Output is correct |
46 |
Correct |
1014 ms |
126268 KB |
Output is correct |
47 |
Correct |
1024 ms |
126224 KB |
Output is correct |
48 |
Correct |
705 ms |
113972 KB |
Output is correct |
49 |
Correct |
959 ms |
123416 KB |
Output is correct |
50 |
Correct |
669 ms |
115732 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
21080 KB |
Output is correct |
2 |
Correct |
6 ms |
31324 KB |
Output is correct |
3 |
Correct |
60 ms |
49808 KB |
Output is correct |
4 |
Correct |
46 ms |
50512 KB |
Output is correct |
5 |
Correct |
821 ms |
114112 KB |
Output is correct |
6 |
Correct |
210 ms |
92908 KB |
Output is correct |
7 |
Correct |
194 ms |
89852 KB |
Output is correct |
8 |
Correct |
58 ms |
64852 KB |
Output is correct |
9 |
Correct |
164 ms |
84156 KB |
Output is correct |
10 |
Correct |
177 ms |
84352 KB |
Output is correct |
11 |
Correct |
155 ms |
84244 KB |
Output is correct |
12 |
Correct |
171 ms |
84164 KB |
Output is correct |
13 |
Correct |
4 ms |
21080 KB |
Output is correct |
14 |
Correct |
51 ms |
60496 KB |
Output is correct |
15 |
Correct |
52 ms |
60380 KB |
Output is correct |
16 |
Correct |
4 ms |
21080 KB |
Output is correct |
17 |
Correct |
860 ms |
115480 KB |
Output is correct |
18 |
Correct |
959 ms |
115532 KB |
Output is correct |
19 |
Correct |
950 ms |
115212 KB |
Output is correct |
20 |
Correct |
954 ms |
114980 KB |
Output is correct |
21 |
Correct |
921 ms |
115664 KB |
Output is correct |
22 |
Correct |
629 ms |
108792 KB |
Output is correct |
23 |
Correct |
638 ms |
104832 KB |
Output is correct |
24 |
Correct |
322 ms |
97448 KB |
Output is correct |
25 |
Correct |
210 ms |
92360 KB |
Output is correct |
26 |
Correct |
6 ms |
21084 KB |
Output is correct |
27 |
Correct |
858 ms |
115268 KB |
Output is correct |
28 |
Correct |
881 ms |
115164 KB |
Output is correct |
29 |
Correct |
886 ms |
115260 KB |
Output is correct |
30 |
Correct |
899 ms |
114896 KB |
Output is correct |
31 |
Correct |
929 ms |
115144 KB |
Output is correct |
32 |
Correct |
688 ms |
108768 KB |
Output is correct |
33 |
Correct |
574 ms |
104280 KB |
Output is correct |
34 |
Correct |
237 ms |
93704 KB |
Output is correct |
35 |
Correct |
198 ms |
92360 KB |
Output is correct |
36 |
Correct |
122 ms |
69528 KB |
Output is correct |
37 |
Correct |
129 ms |
69584 KB |
Output is correct |
38 |
Correct |
123 ms |
69504 KB |
Output is correct |
39 |
Correct |
116 ms |
69560 KB |
Output is correct |
40 |
Correct |
125 ms |
69640 KB |
Output is correct |
41 |
Correct |
111 ms |
69576 KB |
Output is correct |
42 |
Correct |
138 ms |
69776 KB |
Output is correct |
43 |
Correct |
122 ms |
69520 KB |
Output is correct |
44 |
Correct |
121 ms |
69788 KB |
Output is correct |
45 |
Correct |
107 ms |
69624 KB |
Output is correct |
46 |
Correct |
54 ms |
50032 KB |
Output is correct |
47 |
Correct |
53 ms |
50024 KB |
Output is correct |
48 |
Correct |
71 ms |
50720 KB |
Output is correct |
49 |
Correct |
57 ms |
50628 KB |
Output is correct |
50 |
Correct |
753 ms |
111020 KB |
Output is correct |
51 |
Correct |
277 ms |
94912 KB |
Output is correct |
52 |
Correct |
210 ms |
92196 KB |
Output is correct |
53 |
Correct |
852 ms |
113668 KB |
Output is correct |
54 |
Correct |
316 ms |
96764 KB |
Output is correct |
55 |
Correct |
127 ms |
80212 KB |
Output is correct |
56 |
Correct |
57 ms |
68952 KB |
Output is correct |
57 |
Correct |
54 ms |
68944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
43612 KB |
Output is correct |
2 |
Correct |
5 ms |
21084 KB |
Output is correct |
3 |
Correct |
6 ms |
31320 KB |
Output is correct |
4 |
Correct |
8 ms |
43612 KB |
Output is correct |
5 |
Correct |
7 ms |
43612 KB |
Output is correct |
6 |
Correct |
60 ms |
49152 KB |
Output is correct |
7 |
Correct |
62 ms |
46728 KB |
Output is correct |
8 |
Correct |
112 ms |
58004 KB |
Output is correct |
9 |
Correct |
141 ms |
57892 KB |
Output is correct |
10 |
Correct |
121 ms |
58060 KB |
Output is correct |
11 |
Correct |
112 ms |
57936 KB |
Output is correct |
12 |
Correct |
4 ms |
21084 KB |
Output is correct |
13 |
Correct |
7 ms |
33628 KB |
Output is correct |
14 |
Correct |
6 ms |
33700 KB |
Output is correct |
15 |
Correct |
5 ms |
21084 KB |
Output is correct |
16 |
Correct |
119 ms |
58524 KB |
Output is correct |
17 |
Correct |
142 ms |
58384 KB |
Output is correct |
18 |
Correct |
161 ms |
58448 KB |
Output is correct |
19 |
Correct |
144 ms |
58432 KB |
Output is correct |
20 |
Correct |
157 ms |
58452 KB |
Output is correct |
21 |
Correct |
134 ms |
58432 KB |
Output is correct |
22 |
Correct |
119 ms |
58460 KB |
Output is correct |
23 |
Correct |
154 ms |
58192 KB |
Output is correct |
24 |
Correct |
5 ms |
21084 KB |
Output is correct |
25 |
Correct |
116 ms |
58572 KB |
Output is correct |
26 |
Correct |
119 ms |
58388 KB |
Output is correct |
27 |
Correct |
120 ms |
58448 KB |
Output is correct |
28 |
Correct |
138 ms |
58324 KB |
Output is correct |
29 |
Correct |
119 ms |
58476 KB |
Output is correct |
30 |
Correct |
123 ms |
58456 KB |
Output is correct |
31 |
Correct |
117 ms |
58432 KB |
Output is correct |
32 |
Correct |
123 ms |
58192 KB |
Output is correct |
33 |
Correct |
114 ms |
55820 KB |
Output is correct |
34 |
Correct |
111 ms |
55744 KB |
Output is correct |
35 |
Correct |
120 ms |
55644 KB |
Output is correct |
36 |
Correct |
147 ms |
55636 KB |
Output is correct |
37 |
Correct |
11 ms |
44124 KB |
Output is correct |
38 |
Correct |
9 ms |
44120 KB |
Output is correct |
39 |
Correct |
9 ms |
44124 KB |
Output is correct |
40 |
Correct |
9 ms |
44120 KB |
Output is correct |
41 |
Correct |
99 ms |
55472 KB |
Output is correct |
42 |
Correct |
105 ms |
55504 KB |
Output is correct |
43 |
Correct |
110 ms |
56912 KB |
Output is correct |
44 |
Correct |
143 ms |
56880 KB |
Output is correct |
45 |
Correct |
121 ms |
58380 KB |
Output is correct |
46 |
Correct |
150 ms |
58192 KB |
Output is correct |
47 |
Correct |
114 ms |
58124 KB |
Output is correct |
48 |
Correct |
112 ms |
55648 KB |
Output is correct |
49 |
Correct |
117 ms |
55636 KB |
Output is correct |
50 |
Correct |
10 ms |
44376 KB |
Output is correct |
51 |
Correct |
69 ms |
50892 KB |
Output is correct |
52 |
Correct |
62 ms |
51592 KB |
Output is correct |
53 |
Correct |
8 ms |
43604 KB |
Output is correct |
54 |
Correct |
873 ms |
114036 KB |
Output is correct |
55 |
Correct |
541 ms |
96780 KB |
Output is correct |
56 |
Correct |
530 ms |
97636 KB |
Output is correct |
57 |
Correct |
5 ms |
21084 KB |
Output is correct |
58 |
Correct |
5 ms |
21084 KB |
Output is correct |
59 |
Correct |
7 ms |
31324 KB |
Output is correct |
60 |
Correct |
100 ms |
55568 KB |
Output is correct |
61 |
Correct |
79 ms |
55896 KB |
Output is correct |
62 |
Correct |
155 ms |
83324 KB |
Output is correct |
63 |
Correct |
509 ms |
93124 KB |
Output is correct |
64 |
Correct |
476 ms |
97784 KB |
Output is correct |
65 |
Correct |
433 ms |
97792 KB |
Output is correct |
66 |
Correct |
465 ms |
97836 KB |
Output is correct |
67 |
Correct |
410 ms |
97804 KB |
Output is correct |
68 |
Correct |
4 ms |
21084 KB |
Output is correct |
69 |
Correct |
53 ms |
60496 KB |
Output is correct |
70 |
Correct |
52 ms |
60508 KB |
Output is correct |
71 |
Correct |
5 ms |
21080 KB |
Output is correct |
72 |
Correct |
1134 ms |
126464 KB |
Output is correct |
73 |
Correct |
1031 ms |
126196 KB |
Output is correct |
74 |
Correct |
1027 ms |
125980 KB |
Output is correct |
75 |
Correct |
1075 ms |
126836 KB |
Output is correct |
76 |
Correct |
972 ms |
126344 KB |
Output is correct |
77 |
Correct |
1018 ms |
126572 KB |
Output is correct |
78 |
Correct |
1117 ms |
126268 KB |
Output is correct |
79 |
Correct |
1064 ms |
125764 KB |
Output is correct |
80 |
Correct |
669 ms |
113684 KB |
Output is correct |
81 |
Correct |
5 ms |
21080 KB |
Output is correct |
82 |
Correct |
1020 ms |
126540 KB |
Output is correct |
83 |
Correct |
1127 ms |
126580 KB |
Output is correct |
84 |
Correct |
1066 ms |
126316 KB |
Output is correct |
85 |
Correct |
1139 ms |
126436 KB |
Output is correct |
86 |
Correct |
1012 ms |
125824 KB |
Output is correct |
87 |
Correct |
1033 ms |
125248 KB |
Output is correct |
88 |
Correct |
1052 ms |
125464 KB |
Output is correct |
89 |
Correct |
1058 ms |
124760 KB |
Output is correct |
90 |
Correct |
579 ms |
112340 KB |
Output is correct |
91 |
Correct |
298 ms |
82768 KB |
Output is correct |
92 |
Correct |
296 ms |
82588 KB |
Output is correct |
93 |
Correct |
352 ms |
82468 KB |
Output is correct |
94 |
Correct |
309 ms |
82976 KB |
Output is correct |
95 |
Correct |
100 ms |
55632 KB |
Output is correct |
96 |
Correct |
100 ms |
55636 KB |
Output is correct |
97 |
Correct |
109 ms |
56840 KB |
Output is correct |
98 |
Correct |
114 ms |
56936 KB |
Output is correct |
99 |
Correct |
1014 ms |
126268 KB |
Output is correct |
100 |
Correct |
1024 ms |
126224 KB |
Output is correct |
101 |
Correct |
705 ms |
113972 KB |
Output is correct |
102 |
Correct |
959 ms |
123416 KB |
Output is correct |
103 |
Correct |
669 ms |
115732 KB |
Output is correct |
104 |
Correct |
4 ms |
21080 KB |
Output is correct |
105 |
Correct |
6 ms |
31324 KB |
Output is correct |
106 |
Correct |
60 ms |
49808 KB |
Output is correct |
107 |
Correct |
46 ms |
50512 KB |
Output is correct |
108 |
Correct |
821 ms |
114112 KB |
Output is correct |
109 |
Correct |
210 ms |
92908 KB |
Output is correct |
110 |
Correct |
194 ms |
89852 KB |
Output is correct |
111 |
Correct |
58 ms |
64852 KB |
Output is correct |
112 |
Correct |
164 ms |
84156 KB |
Output is correct |
113 |
Correct |
177 ms |
84352 KB |
Output is correct |
114 |
Correct |
155 ms |
84244 KB |
Output is correct |
115 |
Correct |
171 ms |
84164 KB |
Output is correct |
116 |
Correct |
4 ms |
21080 KB |
Output is correct |
117 |
Correct |
51 ms |
60496 KB |
Output is correct |
118 |
Correct |
52 ms |
60380 KB |
Output is correct |
119 |
Correct |
4 ms |
21080 KB |
Output is correct |
120 |
Correct |
860 ms |
115480 KB |
Output is correct |
121 |
Correct |
959 ms |
115532 KB |
Output is correct |
122 |
Correct |
950 ms |
115212 KB |
Output is correct |
123 |
Correct |
954 ms |
114980 KB |
Output is correct |
124 |
Correct |
921 ms |
115664 KB |
Output is correct |
125 |
Correct |
629 ms |
108792 KB |
Output is correct |
126 |
Correct |
638 ms |
104832 KB |
Output is correct |
127 |
Correct |
322 ms |
97448 KB |
Output is correct |
128 |
Correct |
210 ms |
92360 KB |
Output is correct |
129 |
Correct |
6 ms |
21084 KB |
Output is correct |
130 |
Correct |
858 ms |
115268 KB |
Output is correct |
131 |
Correct |
881 ms |
115164 KB |
Output is correct |
132 |
Correct |
886 ms |
115260 KB |
Output is correct |
133 |
Correct |
899 ms |
114896 KB |
Output is correct |
134 |
Correct |
929 ms |
115144 KB |
Output is correct |
135 |
Correct |
688 ms |
108768 KB |
Output is correct |
136 |
Correct |
574 ms |
104280 KB |
Output is correct |
137 |
Correct |
237 ms |
93704 KB |
Output is correct |
138 |
Correct |
198 ms |
92360 KB |
Output is correct |
139 |
Correct |
122 ms |
69528 KB |
Output is correct |
140 |
Correct |
129 ms |
69584 KB |
Output is correct |
141 |
Correct |
123 ms |
69504 KB |
Output is correct |
142 |
Correct |
116 ms |
69560 KB |
Output is correct |
143 |
Correct |
125 ms |
69640 KB |
Output is correct |
144 |
Correct |
111 ms |
69576 KB |
Output is correct |
145 |
Correct |
138 ms |
69776 KB |
Output is correct |
146 |
Correct |
122 ms |
69520 KB |
Output is correct |
147 |
Correct |
121 ms |
69788 KB |
Output is correct |
148 |
Correct |
107 ms |
69624 KB |
Output is correct |
149 |
Correct |
54 ms |
50032 KB |
Output is correct |
150 |
Correct |
53 ms |
50024 KB |
Output is correct |
151 |
Correct |
71 ms |
50720 KB |
Output is correct |
152 |
Correct |
57 ms |
50628 KB |
Output is correct |
153 |
Correct |
753 ms |
111020 KB |
Output is correct |
154 |
Correct |
277 ms |
94912 KB |
Output is correct |
155 |
Correct |
210 ms |
92196 KB |
Output is correct |
156 |
Correct |
852 ms |
113668 KB |
Output is correct |
157 |
Correct |
316 ms |
96764 KB |
Output is correct |
158 |
Correct |
127 ms |
80212 KB |
Output is correct |
159 |
Correct |
57 ms |
68952 KB |
Output is correct |
160 |
Correct |
54 ms |
68944 KB |
Output is correct |
161 |
Correct |
5 ms |
21084 KB |
Output is correct |
162 |
Correct |
6 ms |
31176 KB |
Output is correct |
163 |
Correct |
105 ms |
55396 KB |
Output is correct |
164 |
Correct |
86 ms |
55892 KB |
Output is correct |
165 |
Correct |
203 ms |
90236 KB |
Output is correct |
166 |
Correct |
825 ms |
110692 KB |
Output is correct |
167 |
Correct |
645 ms |
111364 KB |
Output is correct |
168 |
Correct |
633 ms |
111184 KB |
Output is correct |
169 |
Correct |
607 ms |
111348 KB |
Output is correct |
170 |
Correct |
599 ms |
111324 KB |
Output is correct |
171 |
Correct |
5 ms |
21080 KB |
Output is correct |
172 |
Correct |
54 ms |
60308 KB |
Output is correct |
173 |
Correct |
52 ms |
60500 KB |
Output is correct |
174 |
Correct |
6 ms |
21084 KB |
Output is correct |
175 |
Correct |
1761 ms |
160196 KB |
Output is correct |
176 |
Correct |
1754 ms |
161424 KB |
Output is correct |
177 |
Correct |
1781 ms |
160244 KB |
Output is correct |
178 |
Correct |
1785 ms |
161200 KB |
Output is correct |
179 |
Correct |
1812 ms |
160616 KB |
Output is correct |
180 |
Correct |
1713 ms |
160804 KB |
Output is correct |
181 |
Correct |
1779 ms |
160428 KB |
Output is correct |
182 |
Correct |
1686 ms |
154432 KB |
Output is correct |
183 |
Correct |
762 ms |
119228 KB |
Output is correct |
184 |
Correct |
4 ms |
21080 KB |
Output is correct |
185 |
Correct |
1761 ms |
160420 KB |
Output is correct |
186 |
Correct |
1718 ms |
160260 KB |
Output is correct |
187 |
Correct |
1663 ms |
161068 KB |
Output is correct |
188 |
Correct |
1713 ms |
160724 KB |
Output is correct |
189 |
Correct |
1691 ms |
159968 KB |
Output is correct |
190 |
Correct |
1621 ms |
159624 KB |
Output is correct |
191 |
Correct |
1667 ms |
158672 KB |
Output is correct |
192 |
Correct |
1406 ms |
139780 KB |
Output is correct |
193 |
Correct |
668 ms |
118212 KB |
Output is correct |
194 |
Correct |
378 ms |
87756 KB |
Output is correct |
195 |
Correct |
418 ms |
89224 KB |
Output is correct |
196 |
Correct |
402 ms |
89016 KB |
Output is correct |
197 |
Correct |
386 ms |
89288 KB |
Output is correct |
198 |
Correct |
374 ms |
89280 KB |
Output is correct |
199 |
Correct |
393 ms |
89352 KB |
Output is correct |
200 |
Correct |
375 ms |
89392 KB |
Output is correct |
201 |
Correct |
385 ms |
89544 KB |
Output is correct |
202 |
Correct |
388 ms |
89372 KB |
Output is correct |
203 |
Correct |
103 ms |
55816 KB |
Output is correct |
204 |
Correct |
98 ms |
55632 KB |
Output is correct |
205 |
Correct |
107 ms |
56916 KB |
Output is correct |
206 |
Correct |
108 ms |
56916 KB |
Output is correct |
207 |
Correct |
1710 ms |
160712 KB |
Output is correct |
208 |
Correct |
1499 ms |
146480 KB |
Output is correct |
209 |
Correct |
722 ms |
119436 KB |
Output is correct |
210 |
Correct |
1718 ms |
158924 KB |
Output is correct |
211 |
Correct |
710 ms |
117472 KB |
Output is correct |
212 |
Correct |
434 ms |
100004 KB |
Output is correct |
213 |
Correct |
801 ms |
115368 KB |
Output is correct |
214 |
Correct |
811 ms |
114880 KB |
Output is correct |