#include<iostream>
#include<vector>
#include<cassert>
#include<algorithm>
#include "roads.h"
using namespace std;
#define mp make_pair
#define fr first
#define sc second
#define pb push_back
#define all(x) x.begin(),x.end()
#define sz(x) int32_t(x.size())
#define int long long
const int maxn = 2e5+10;
const int inf = 1e18+10;
const int mnv = -1e15-10;
const int mxv = 1e15+10;
int n, dp[maxn][2], mark[maxn], atv[maxn];
vector<int> g[maxn], gr[maxn];
vector<pair<int,int>> gesp[maxn];
int cnt[maxn];
vector<int> trq[maxn], trs[maxn], f1[maxn], f2[maxn];
//add/remove pos from id
int att(int no, int l, int r, int id, int pos, int val) {
// cout << " " << no << " " << l << " " << r << endl;
if(l > pos || r < pos) return no;
if(no == 0) {
no = ++cnt[id];
}
//trq[id][trq[id].size()-1]
while(no >= sz(f1[id])) {
trq[id].pb(0);
trs[id].pb(0);
f1[id].pb(0);
f2[id].pb(0);
}
if(l == r) {
assert(no < sz(trq[id]));
trq[id][no]+= val;
assert(no < sz(trs[id]));
trs[id][no]+= val*pos;
return no;
}
int mid = (l+r)>>1;
// cout << no << " -> " << f1[id][no] << endl;
// int abc;
// f1[id][no] = abc = att(f1[id][no],l,mid,id,pos,val);
// assert(no < sz(f1[id]));
// f1[id][no] = att(f1[id][no],l,mid,id,pos,val);
// int wtf = f1[id][no];
// f1[id][no] = att(wtf,l,mid,id,pos,val);
int aux;
aux = att(f1[id][no],l,mid,id,pos,val);
f1[id][no] = aux;
aux = att(f2[id][no],mid+1,r,id,pos,val);
f2[id][no] = aux;
// f1[id][no] = att(f1[id][no],l,mid,id,pos,val);
// f2[id][no] = att(f2[id][no],mid+1,r,id,pos,val);
trq[id][no] = trq[id][f1[id][no]]+trq[id][f2[id][no]];
trs[id][no] = trs[id][f1[id][no]]+trs[id][f2[id][no]];
// cout << " " << no << " " << l << " " << r << " " << trq[id][no] << " " << pos << " " << f1[id][no] << " " << f2[id][no] << endl;
// cout << aux << endl;
// cout << no << " <- " << f1[id][no] << endl;
// cout << no << endl;
return no;
}
int find(int no, int l, int r, int id, int val) {
// cout << no << " " << l << " " << r << " " << trq[id][no] << " " << trs[id][no] << " " << val << endl;
//quero pegar os val menores caras em (l,r)
if(no == 0) return 0;
if(l == r) {
// cout << l << " " << val << endl;
return val*r;
}
int mid = (l+r)>>1;
if(trq[id][f1[id][no]] >= val) return find(f1[id][no],l,mid,id,val);
else return trs[id][f1[id][no]]+find(f2[id][no],mid+1,r,id,val-trq[id][f1[id][no]]);
}
void dfs(int u, int qtd, int ant) {
mark[u] = 1;
int ans = 0;
vector<int> use;
for(auto V : gesp[u]) if(V.fr != ant) {
int v = V.fr;
int w = V.sc;
dfs(v,qtd,u);
ans+= min(dp[v][0],dp[v][1]+w);
use.pb(-min(dp[v][0],dp[v][1]+w)+dp[v][1]+w);
att(1,mnv,mxv,u,-min(dp[v][0],dp[v][1]+w)+dp[v][1]+w,1);
}
// sort(all(use));
//se nao tem a aresta com o pai -> sz(g[u])-1-qtd = t
dp[u][0] = dp[u][1] = inf;
if(sz(g[u])-qtd-1 <= 0) dp[u][1] = ans;
else dp[u][1] = ans+find(1,mnv,mxv,u,sz(g[u])-qtd-1);
if(sz(g[u])-qtd <= 0) dp[u][0] = ans;
else dp[u][0] = ans+find(1,mnv,mxv,u,sz(g[u])-qtd);
// cout << " " << u << " " << qtd << " " << sz(g[u]) << " " << ans << " " << find(1,mnv,mxv,u,sz(g[u])-qtd) << endl;
for(auto x : use) {
att(1,mnv,mxv,u,x,-1);
}
// for(int i = 1; i <= sz(g[u])-qtd; i++) {
// ans+= use[i-1];
// if(i == sz(g[u])-qtd-1) dp[u][1] = ans;
// if(i == sz(g[u])-qtd) dp[u][0] = ans;
// }
}
std::vector<int> minimum_closure_costs(int32_t N, std::vector<int32_t> U,std::vector<int32_t> V,std::vector<int32_t> W) {
n = N;
vector<int> ans;
int sumw = 0;
for(int i = 0; i < n-1; i++) {
int u = U[i];
int v = V[i];
int w = W[i];
sumw+= w;
g[u].pb(i);
g[v].pb(i);
// gesp[u].pb(mp(v,w));
// gesp[v].pb(mp(u,w));
}
for(int i = 0; i < n; i++) {
cnt[i] = 1;
gr[sz(g[i])].pb(i);
// trq[i].resize(60*maxn);
// trs[i].resize(60*maxn);
// f1[i].resize(60*maxn);
// f2[i].resize(60*maxn);
}
vector<int> esp;
for(int k = n-1; k >=1; k--) {
for(auto i : gr[k]) {
atv[i] = 1;
// cout << i << endl;
esp.pb(i);
for(auto id : g[i]) {
int v = i^U[id]^V[id];
int w = W[id];
if(atv[v]) {
gesp[i].pb(mp(v,w));
gesp[v].pb(mp(i,w));
att(1,mnv,mxv,v,w,-1);
}
else {
// cout << " " << i << " " << v << " " << w << endl;
att(1,mnv,mxv,i,w,1);
}
}
}
// att(1,mnv,mxv,0,40,1);
// cout << " - " << find(1,mnv,mxv,0,1) << endl;
int ans1 = 0;
for(auto x : esp) {
if(!mark[x]) {
// cout << x << " " << x << endl;
dfs(x,k,-1);
ans1+= dp[x][0];
}
}
// dfs(0,k,-1);
ans.pb(ans1);
for(auto v : esp) {
mark[v] = 0;
}
}
ans.pb(sumw);
reverse(all(ans));
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
33108 KB |
Output is correct |
2 |
Correct |
30 ms |
34764 KB |
Output is correct |
3 |
Correct |
30 ms |
34772 KB |
Output is correct |
4 |
Correct |
26 ms |
33560 KB |
Output is correct |
5 |
Correct |
17 ms |
33352 KB |
Output is correct |
6 |
Correct |
21 ms |
33492 KB |
Output is correct |
7 |
Correct |
18 ms |
33236 KB |
Output is correct |
8 |
Correct |
25 ms |
33480 KB |
Output is correct |
9 |
Correct |
26 ms |
33584 KB |
Output is correct |
10 |
Correct |
18 ms |
33236 KB |
Output is correct |
11 |
Correct |
20 ms |
33132 KB |
Output is correct |
12 |
Correct |
332 ms |
44544 KB |
Output is correct |
13 |
Correct |
510 ms |
53244 KB |
Output is correct |
14 |
Correct |
894 ms |
90356 KB |
Output is correct |
15 |
Correct |
1004 ms |
98968 KB |
Output is correct |
16 |
Correct |
1035 ms |
97952 KB |
Output is correct |
17 |
Correct |
537 ms |
54104 KB |
Output is correct |
18 |
Correct |
17 ms |
33108 KB |
Output is correct |
19 |
Correct |
434 ms |
51492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
33108 KB |
Output is correct |
2 |
Correct |
1014 ms |
374172 KB |
Output is correct |
3 |
Correct |
1109 ms |
392036 KB |
Output is correct |
4 |
Correct |
1185 ms |
435756 KB |
Output is correct |
5 |
Correct |
1107 ms |
374368 KB |
Output is correct |
6 |
Correct |
37 ms |
40316 KB |
Output is correct |
7 |
Correct |
47 ms |
40908 KB |
Output is correct |
8 |
Correct |
36 ms |
39212 KB |
Output is correct |
9 |
Correct |
24 ms |
33764 KB |
Output is correct |
10 |
Correct |
19 ms |
33816 KB |
Output is correct |
11 |
Correct |
19 ms |
33868 KB |
Output is correct |
12 |
Correct |
606 ms |
201440 KB |
Output is correct |
13 |
Correct |
1025 ms |
335672 KB |
Output is correct |
14 |
Correct |
20 ms |
33108 KB |
Output is correct |
15 |
Correct |
957 ms |
339772 KB |
Output is correct |
16 |
Correct |
1046 ms |
373400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
33108 KB |
Output is correct |
2 |
Correct |
17 ms |
33188 KB |
Output is correct |
3 |
Correct |
16 ms |
33216 KB |
Output is correct |
4 |
Correct |
18 ms |
33748 KB |
Output is correct |
5 |
Correct |
19 ms |
33748 KB |
Output is correct |
6 |
Correct |
20 ms |
33208 KB |
Output is correct |
7 |
Correct |
19 ms |
33728 KB |
Output is correct |
8 |
Correct |
19 ms |
33468 KB |
Output is correct |
9 |
Correct |
18 ms |
33680 KB |
Output is correct |
10 |
Correct |
19 ms |
33784 KB |
Output is correct |
11 |
Correct |
19 ms |
33844 KB |
Output is correct |
12 |
Correct |
19 ms |
33876 KB |
Output is correct |
13 |
Correct |
18 ms |
33364 KB |
Output is correct |
14 |
Correct |
21 ms |
33420 KB |
Output is correct |
15 |
Correct |
18 ms |
33224 KB |
Output is correct |
16 |
Correct |
18 ms |
33384 KB |
Output is correct |
17 |
Correct |
18 ms |
33532 KB |
Output is correct |
18 |
Correct |
18 ms |
33376 KB |
Output is correct |
19 |
Correct |
17 ms |
33236 KB |
Output is correct |
20 |
Correct |
16 ms |
33236 KB |
Output is correct |
21 |
Correct |
17 ms |
33224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
33108 KB |
Output is correct |
2 |
Correct |
17 ms |
33188 KB |
Output is correct |
3 |
Correct |
16 ms |
33216 KB |
Output is correct |
4 |
Correct |
18 ms |
33748 KB |
Output is correct |
5 |
Correct |
19 ms |
33748 KB |
Output is correct |
6 |
Correct |
20 ms |
33208 KB |
Output is correct |
7 |
Correct |
19 ms |
33728 KB |
Output is correct |
8 |
Correct |
19 ms |
33468 KB |
Output is correct |
9 |
Correct |
18 ms |
33680 KB |
Output is correct |
10 |
Correct |
19 ms |
33784 KB |
Output is correct |
11 |
Correct |
19 ms |
33844 KB |
Output is correct |
12 |
Correct |
19 ms |
33876 KB |
Output is correct |
13 |
Correct |
18 ms |
33364 KB |
Output is correct |
14 |
Correct |
21 ms |
33420 KB |
Output is correct |
15 |
Correct |
18 ms |
33224 KB |
Output is correct |
16 |
Correct |
18 ms |
33384 KB |
Output is correct |
17 |
Correct |
18 ms |
33532 KB |
Output is correct |
18 |
Correct |
18 ms |
33376 KB |
Output is correct |
19 |
Correct |
17 ms |
33236 KB |
Output is correct |
20 |
Correct |
16 ms |
33236 KB |
Output is correct |
21 |
Correct |
17 ms |
33224 KB |
Output is correct |
22 |
Correct |
17 ms |
33108 KB |
Output is correct |
23 |
Correct |
30 ms |
37204 KB |
Output is correct |
24 |
Correct |
41 ms |
39968 KB |
Output is correct |
25 |
Correct |
31 ms |
35868 KB |
Output is correct |
26 |
Correct |
32 ms |
35104 KB |
Output is correct |
27 |
Correct |
37 ms |
35668 KB |
Output is correct |
28 |
Correct |
29 ms |
33588 KB |
Output is correct |
29 |
Correct |
36 ms |
38748 KB |
Output is correct |
30 |
Correct |
35 ms |
36240 KB |
Output is correct |
31 |
Correct |
32 ms |
33876 KB |
Output is correct |
32 |
Correct |
30 ms |
33604 KB |
Output is correct |
33 |
Correct |
37 ms |
40268 KB |
Output is correct |
34 |
Correct |
41 ms |
40960 KB |
Output is correct |
35 |
Correct |
39 ms |
39296 KB |
Output is correct |
36 |
Correct |
29 ms |
34760 KB |
Output is correct |
37 |
Correct |
31 ms |
34780 KB |
Output is correct |
38 |
Correct |
27 ms |
33604 KB |
Output is correct |
39 |
Correct |
21 ms |
33152 KB |
Output is correct |
40 |
Correct |
19 ms |
33108 KB |
Output is correct |
41 |
Correct |
18 ms |
33704 KB |
Output is correct |
42 |
Correct |
20 ms |
33840 KB |
Output is correct |
43 |
Correct |
18 ms |
33172 KB |
Output is correct |
44 |
Correct |
18 ms |
33748 KB |
Output is correct |
45 |
Correct |
18 ms |
33508 KB |
Output is correct |
46 |
Correct |
18 ms |
33748 KB |
Output is correct |
47 |
Correct |
19 ms |
33876 KB |
Output is correct |
48 |
Correct |
19 ms |
33876 KB |
Output is correct |
49 |
Correct |
21 ms |
33800 KB |
Output is correct |
50 |
Correct |
18 ms |
33304 KB |
Output is correct |
51 |
Correct |
22 ms |
33492 KB |
Output is correct |
52 |
Correct |
21 ms |
33236 KB |
Output is correct |
53 |
Correct |
30 ms |
36044 KB |
Output is correct |
54 |
Correct |
33 ms |
37012 KB |
Output is correct |
55 |
Correct |
29 ms |
33620 KB |
Output is correct |
56 |
Correct |
24 ms |
33480 KB |
Output is correct |
57 |
Correct |
27 ms |
33528 KB |
Output is correct |
58 |
Correct |
18 ms |
33360 KB |
Output is correct |
59 |
Correct |
21 ms |
33484 KB |
Output is correct |
60 |
Correct |
18 ms |
33364 KB |
Output is correct |
61 |
Correct |
17 ms |
33216 KB |
Output is correct |
62 |
Correct |
18 ms |
33260 KB |
Output is correct |
63 |
Correct |
16 ms |
33140 KB |
Output is correct |
64 |
Correct |
34 ms |
37352 KB |
Output is correct |
65 |
Correct |
34 ms |
37388 KB |
Output is correct |
66 |
Correct |
28 ms |
33748 KB |
Output is correct |
67 |
Correct |
29 ms |
33620 KB |
Output is correct |
68 |
Correct |
33 ms |
33620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1125 ms |
237316 KB |
Output is correct |
2 |
Correct |
1131 ms |
234848 KB |
Output is correct |
3 |
Correct |
716 ms |
54248 KB |
Output is correct |
4 |
Correct |
1127 ms |
246392 KB |
Output is correct |
5 |
Correct |
735 ms |
53996 KB |
Output is correct |
6 |
Correct |
690 ms |
51996 KB |
Output is correct |
7 |
Correct |
927 ms |
148796 KB |
Output is correct |
8 |
Correct |
444 ms |
52052 KB |
Output is correct |
9 |
Correct |
1072 ms |
243164 KB |
Output is correct |
10 |
Correct |
1043 ms |
198404 KB |
Output is correct |
11 |
Correct |
673 ms |
54488 KB |
Output is correct |
12 |
Correct |
579 ms |
52928 KB |
Output is correct |
13 |
Correct |
18 ms |
33108 KB |
Output is correct |
14 |
Correct |
947 ms |
339800 KB |
Output is correct |
15 |
Correct |
1045 ms |
373468 KB |
Output is correct |
16 |
Correct |
34 ms |
37400 KB |
Output is correct |
17 |
Correct |
34 ms |
37412 KB |
Output is correct |
18 |
Correct |
29 ms |
33748 KB |
Output is correct |
19 |
Correct |
29 ms |
33716 KB |
Output is correct |
20 |
Correct |
30 ms |
33716 KB |
Output is correct |
21 |
Correct |
450 ms |
51376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1125 ms |
237316 KB |
Output is correct |
2 |
Correct |
1131 ms |
234848 KB |
Output is correct |
3 |
Correct |
716 ms |
54248 KB |
Output is correct |
4 |
Correct |
1127 ms |
246392 KB |
Output is correct |
5 |
Correct |
735 ms |
53996 KB |
Output is correct |
6 |
Correct |
690 ms |
51996 KB |
Output is correct |
7 |
Correct |
927 ms |
148796 KB |
Output is correct |
8 |
Correct |
444 ms |
52052 KB |
Output is correct |
9 |
Correct |
1072 ms |
243164 KB |
Output is correct |
10 |
Correct |
1043 ms |
198404 KB |
Output is correct |
11 |
Correct |
673 ms |
54488 KB |
Output is correct |
12 |
Correct |
579 ms |
52928 KB |
Output is correct |
13 |
Correct |
18 ms |
33108 KB |
Output is correct |
14 |
Correct |
947 ms |
339800 KB |
Output is correct |
15 |
Correct |
1045 ms |
373468 KB |
Output is correct |
16 |
Correct |
34 ms |
37400 KB |
Output is correct |
17 |
Correct |
34 ms |
37412 KB |
Output is correct |
18 |
Correct |
29 ms |
33748 KB |
Output is correct |
19 |
Correct |
29 ms |
33716 KB |
Output is correct |
20 |
Correct |
30 ms |
33716 KB |
Output is correct |
21 |
Correct |
450 ms |
51376 KB |
Output is correct |
22 |
Correct |
17 ms |
33108 KB |
Output is correct |
23 |
Correct |
19 ms |
33124 KB |
Output is correct |
24 |
Correct |
17 ms |
33108 KB |
Output is correct |
25 |
Correct |
963 ms |
198448 KB |
Output is correct |
26 |
Correct |
868 ms |
184312 KB |
Output is correct |
27 |
Correct |
1123 ms |
228616 KB |
Output is correct |
28 |
Correct |
727 ms |
54564 KB |
Output is correct |
29 |
Correct |
666 ms |
52272 KB |
Output is correct |
30 |
Correct |
656 ms |
51392 KB |
Output is correct |
31 |
Correct |
639 ms |
52072 KB |
Output is correct |
32 |
Correct |
972 ms |
181600 KB |
Output is correct |
33 |
Correct |
468 ms |
52504 KB |
Output is correct |
34 |
Correct |
923 ms |
142644 KB |
Output is correct |
35 |
Correct |
1144 ms |
223096 KB |
Output is correct |
36 |
Correct |
686 ms |
54656 KB |
Output is correct |
37 |
Correct |
581 ms |
52876 KB |
Output is correct |
38 |
Correct |
614 ms |
201384 KB |
Output is correct |
39 |
Correct |
1034 ms |
335644 KB |
Output is correct |
40 |
Correct |
30 ms |
36052 KB |
Output is correct |
41 |
Correct |
35 ms |
37084 KB |
Output is correct |
42 |
Correct |
31 ms |
33612 KB |
Output is correct |
43 |
Correct |
25 ms |
33568 KB |
Output is correct |
44 |
Correct |
27 ms |
33596 KB |
Output is correct |
45 |
Correct |
18 ms |
33324 KB |
Output is correct |
46 |
Correct |
20 ms |
33576 KB |
Output is correct |
47 |
Correct |
18 ms |
33364 KB |
Output is correct |
48 |
Correct |
17 ms |
33156 KB |
Output is correct |
49 |
Correct |
19 ms |
33236 KB |
Output is correct |
50 |
Correct |
299 ms |
45184 KB |
Output is correct |
51 |
Correct |
489 ms |
53224 KB |
Output is correct |
52 |
Correct |
1091 ms |
238716 KB |
Output is correct |
53 |
Correct |
1111 ms |
234844 KB |
Output is correct |
54 |
Correct |
715 ms |
54300 KB |
Output is correct |
55 |
Correct |
1137 ms |
246432 KB |
Output is correct |
56 |
Correct |
703 ms |
53980 KB |
Output is correct |
57 |
Correct |
673 ms |
52004 KB |
Output is correct |
58 |
Correct |
949 ms |
148812 KB |
Output is correct |
59 |
Correct |
452 ms |
52132 KB |
Output is correct |
60 |
Correct |
1076 ms |
243140 KB |
Output is correct |
61 |
Correct |
1066 ms |
198364 KB |
Output is correct |
62 |
Correct |
680 ms |
54368 KB |
Output is correct |
63 |
Correct |
599 ms |
52952 KB |
Output is correct |
64 |
Correct |
17 ms |
33108 KB |
Output is correct |
65 |
Correct |
947 ms |
339736 KB |
Output is correct |
66 |
Correct |
1045 ms |
373536 KB |
Output is correct |
67 |
Correct |
33 ms |
37376 KB |
Output is correct |
68 |
Correct |
34 ms |
37364 KB |
Output is correct |
69 |
Correct |
31 ms |
33712 KB |
Output is correct |
70 |
Correct |
30 ms |
33584 KB |
Output is correct |
71 |
Correct |
34 ms |
33740 KB |
Output is correct |
72 |
Correct |
433 ms |
51548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
33108 KB |
Output is correct |
2 |
Correct |
30 ms |
34764 KB |
Output is correct |
3 |
Correct |
30 ms |
34772 KB |
Output is correct |
4 |
Correct |
26 ms |
33560 KB |
Output is correct |
5 |
Correct |
17 ms |
33352 KB |
Output is correct |
6 |
Correct |
21 ms |
33492 KB |
Output is correct |
7 |
Correct |
18 ms |
33236 KB |
Output is correct |
8 |
Correct |
25 ms |
33480 KB |
Output is correct |
9 |
Correct |
26 ms |
33584 KB |
Output is correct |
10 |
Correct |
18 ms |
33236 KB |
Output is correct |
11 |
Correct |
20 ms |
33132 KB |
Output is correct |
12 |
Correct |
332 ms |
44544 KB |
Output is correct |
13 |
Correct |
510 ms |
53244 KB |
Output is correct |
14 |
Correct |
894 ms |
90356 KB |
Output is correct |
15 |
Correct |
1004 ms |
98968 KB |
Output is correct |
16 |
Correct |
1035 ms |
97952 KB |
Output is correct |
17 |
Correct |
537 ms |
54104 KB |
Output is correct |
18 |
Correct |
17 ms |
33108 KB |
Output is correct |
19 |
Correct |
434 ms |
51492 KB |
Output is correct |
20 |
Correct |
18 ms |
33108 KB |
Output is correct |
21 |
Correct |
1014 ms |
374172 KB |
Output is correct |
22 |
Correct |
1109 ms |
392036 KB |
Output is correct |
23 |
Correct |
1185 ms |
435756 KB |
Output is correct |
24 |
Correct |
1107 ms |
374368 KB |
Output is correct |
25 |
Correct |
37 ms |
40316 KB |
Output is correct |
26 |
Correct |
47 ms |
40908 KB |
Output is correct |
27 |
Correct |
36 ms |
39212 KB |
Output is correct |
28 |
Correct |
24 ms |
33764 KB |
Output is correct |
29 |
Correct |
19 ms |
33816 KB |
Output is correct |
30 |
Correct |
19 ms |
33868 KB |
Output is correct |
31 |
Correct |
606 ms |
201440 KB |
Output is correct |
32 |
Correct |
1025 ms |
335672 KB |
Output is correct |
33 |
Correct |
20 ms |
33108 KB |
Output is correct |
34 |
Correct |
957 ms |
339772 KB |
Output is correct |
35 |
Correct |
1046 ms |
373400 KB |
Output is correct |
36 |
Correct |
17 ms |
33108 KB |
Output is correct |
37 |
Correct |
17 ms |
33188 KB |
Output is correct |
38 |
Correct |
16 ms |
33216 KB |
Output is correct |
39 |
Correct |
18 ms |
33748 KB |
Output is correct |
40 |
Correct |
19 ms |
33748 KB |
Output is correct |
41 |
Correct |
20 ms |
33208 KB |
Output is correct |
42 |
Correct |
19 ms |
33728 KB |
Output is correct |
43 |
Correct |
19 ms |
33468 KB |
Output is correct |
44 |
Correct |
18 ms |
33680 KB |
Output is correct |
45 |
Correct |
19 ms |
33784 KB |
Output is correct |
46 |
Correct |
19 ms |
33844 KB |
Output is correct |
47 |
Correct |
19 ms |
33876 KB |
Output is correct |
48 |
Correct |
18 ms |
33364 KB |
Output is correct |
49 |
Correct |
21 ms |
33420 KB |
Output is correct |
50 |
Correct |
18 ms |
33224 KB |
Output is correct |
51 |
Correct |
18 ms |
33384 KB |
Output is correct |
52 |
Correct |
18 ms |
33532 KB |
Output is correct |
53 |
Correct |
18 ms |
33376 KB |
Output is correct |
54 |
Correct |
17 ms |
33236 KB |
Output is correct |
55 |
Correct |
16 ms |
33236 KB |
Output is correct |
56 |
Correct |
17 ms |
33224 KB |
Output is correct |
57 |
Correct |
17 ms |
33108 KB |
Output is correct |
58 |
Correct |
30 ms |
37204 KB |
Output is correct |
59 |
Correct |
41 ms |
39968 KB |
Output is correct |
60 |
Correct |
31 ms |
35868 KB |
Output is correct |
61 |
Correct |
32 ms |
35104 KB |
Output is correct |
62 |
Correct |
37 ms |
35668 KB |
Output is correct |
63 |
Correct |
29 ms |
33588 KB |
Output is correct |
64 |
Correct |
36 ms |
38748 KB |
Output is correct |
65 |
Correct |
35 ms |
36240 KB |
Output is correct |
66 |
Correct |
32 ms |
33876 KB |
Output is correct |
67 |
Correct |
30 ms |
33604 KB |
Output is correct |
68 |
Correct |
37 ms |
40268 KB |
Output is correct |
69 |
Correct |
41 ms |
40960 KB |
Output is correct |
70 |
Correct |
39 ms |
39296 KB |
Output is correct |
71 |
Correct |
29 ms |
34760 KB |
Output is correct |
72 |
Correct |
31 ms |
34780 KB |
Output is correct |
73 |
Correct |
27 ms |
33604 KB |
Output is correct |
74 |
Correct |
21 ms |
33152 KB |
Output is correct |
75 |
Correct |
19 ms |
33108 KB |
Output is correct |
76 |
Correct |
18 ms |
33704 KB |
Output is correct |
77 |
Correct |
20 ms |
33840 KB |
Output is correct |
78 |
Correct |
18 ms |
33172 KB |
Output is correct |
79 |
Correct |
18 ms |
33748 KB |
Output is correct |
80 |
Correct |
18 ms |
33508 KB |
Output is correct |
81 |
Correct |
18 ms |
33748 KB |
Output is correct |
82 |
Correct |
19 ms |
33876 KB |
Output is correct |
83 |
Correct |
19 ms |
33876 KB |
Output is correct |
84 |
Correct |
21 ms |
33800 KB |
Output is correct |
85 |
Correct |
18 ms |
33304 KB |
Output is correct |
86 |
Correct |
22 ms |
33492 KB |
Output is correct |
87 |
Correct |
21 ms |
33236 KB |
Output is correct |
88 |
Correct |
30 ms |
36044 KB |
Output is correct |
89 |
Correct |
33 ms |
37012 KB |
Output is correct |
90 |
Correct |
29 ms |
33620 KB |
Output is correct |
91 |
Correct |
24 ms |
33480 KB |
Output is correct |
92 |
Correct |
27 ms |
33528 KB |
Output is correct |
93 |
Correct |
18 ms |
33360 KB |
Output is correct |
94 |
Correct |
21 ms |
33484 KB |
Output is correct |
95 |
Correct |
18 ms |
33364 KB |
Output is correct |
96 |
Correct |
17 ms |
33216 KB |
Output is correct |
97 |
Correct |
18 ms |
33260 KB |
Output is correct |
98 |
Correct |
16 ms |
33140 KB |
Output is correct |
99 |
Correct |
34 ms |
37352 KB |
Output is correct |
100 |
Correct |
34 ms |
37388 KB |
Output is correct |
101 |
Correct |
28 ms |
33748 KB |
Output is correct |
102 |
Correct |
29 ms |
33620 KB |
Output is correct |
103 |
Correct |
33 ms |
33620 KB |
Output is correct |
104 |
Correct |
1125 ms |
237316 KB |
Output is correct |
105 |
Correct |
1131 ms |
234848 KB |
Output is correct |
106 |
Correct |
716 ms |
54248 KB |
Output is correct |
107 |
Correct |
1127 ms |
246392 KB |
Output is correct |
108 |
Correct |
735 ms |
53996 KB |
Output is correct |
109 |
Correct |
690 ms |
51996 KB |
Output is correct |
110 |
Correct |
927 ms |
148796 KB |
Output is correct |
111 |
Correct |
444 ms |
52052 KB |
Output is correct |
112 |
Correct |
1072 ms |
243164 KB |
Output is correct |
113 |
Correct |
1043 ms |
198404 KB |
Output is correct |
114 |
Correct |
673 ms |
54488 KB |
Output is correct |
115 |
Correct |
579 ms |
52928 KB |
Output is correct |
116 |
Correct |
18 ms |
33108 KB |
Output is correct |
117 |
Correct |
947 ms |
339800 KB |
Output is correct |
118 |
Correct |
1045 ms |
373468 KB |
Output is correct |
119 |
Correct |
34 ms |
37400 KB |
Output is correct |
120 |
Correct |
34 ms |
37412 KB |
Output is correct |
121 |
Correct |
29 ms |
33748 KB |
Output is correct |
122 |
Correct |
29 ms |
33716 KB |
Output is correct |
123 |
Correct |
30 ms |
33716 KB |
Output is correct |
124 |
Correct |
450 ms |
51376 KB |
Output is correct |
125 |
Correct |
17 ms |
33108 KB |
Output is correct |
126 |
Correct |
19 ms |
33124 KB |
Output is correct |
127 |
Correct |
17 ms |
33108 KB |
Output is correct |
128 |
Correct |
963 ms |
198448 KB |
Output is correct |
129 |
Correct |
868 ms |
184312 KB |
Output is correct |
130 |
Correct |
1123 ms |
228616 KB |
Output is correct |
131 |
Correct |
727 ms |
54564 KB |
Output is correct |
132 |
Correct |
666 ms |
52272 KB |
Output is correct |
133 |
Correct |
656 ms |
51392 KB |
Output is correct |
134 |
Correct |
639 ms |
52072 KB |
Output is correct |
135 |
Correct |
972 ms |
181600 KB |
Output is correct |
136 |
Correct |
468 ms |
52504 KB |
Output is correct |
137 |
Correct |
923 ms |
142644 KB |
Output is correct |
138 |
Correct |
1144 ms |
223096 KB |
Output is correct |
139 |
Correct |
686 ms |
54656 KB |
Output is correct |
140 |
Correct |
581 ms |
52876 KB |
Output is correct |
141 |
Correct |
614 ms |
201384 KB |
Output is correct |
142 |
Correct |
1034 ms |
335644 KB |
Output is correct |
143 |
Correct |
30 ms |
36052 KB |
Output is correct |
144 |
Correct |
35 ms |
37084 KB |
Output is correct |
145 |
Correct |
31 ms |
33612 KB |
Output is correct |
146 |
Correct |
25 ms |
33568 KB |
Output is correct |
147 |
Correct |
27 ms |
33596 KB |
Output is correct |
148 |
Correct |
18 ms |
33324 KB |
Output is correct |
149 |
Correct |
20 ms |
33576 KB |
Output is correct |
150 |
Correct |
18 ms |
33364 KB |
Output is correct |
151 |
Correct |
17 ms |
33156 KB |
Output is correct |
152 |
Correct |
19 ms |
33236 KB |
Output is correct |
153 |
Correct |
299 ms |
45184 KB |
Output is correct |
154 |
Correct |
489 ms |
53224 KB |
Output is correct |
155 |
Correct |
1091 ms |
238716 KB |
Output is correct |
156 |
Correct |
1111 ms |
234844 KB |
Output is correct |
157 |
Correct |
715 ms |
54300 KB |
Output is correct |
158 |
Correct |
1137 ms |
246432 KB |
Output is correct |
159 |
Correct |
703 ms |
53980 KB |
Output is correct |
160 |
Correct |
673 ms |
52004 KB |
Output is correct |
161 |
Correct |
949 ms |
148812 KB |
Output is correct |
162 |
Correct |
452 ms |
52132 KB |
Output is correct |
163 |
Correct |
1076 ms |
243140 KB |
Output is correct |
164 |
Correct |
1066 ms |
198364 KB |
Output is correct |
165 |
Correct |
680 ms |
54368 KB |
Output is correct |
166 |
Correct |
599 ms |
52952 KB |
Output is correct |
167 |
Correct |
17 ms |
33108 KB |
Output is correct |
168 |
Correct |
947 ms |
339736 KB |
Output is correct |
169 |
Correct |
1045 ms |
373536 KB |
Output is correct |
170 |
Correct |
33 ms |
37376 KB |
Output is correct |
171 |
Correct |
34 ms |
37364 KB |
Output is correct |
172 |
Correct |
31 ms |
33712 KB |
Output is correct |
173 |
Correct |
30 ms |
33584 KB |
Output is correct |
174 |
Correct |
34 ms |
33740 KB |
Output is correct |
175 |
Correct |
433 ms |
51548 KB |
Output is correct |
176 |
Correct |
18 ms |
33192 KB |
Output is correct |
177 |
Correct |
1356 ms |
374992 KB |
Output is correct |
178 |
Correct |
1071 ms |
297300 KB |
Output is correct |
179 |
Correct |
745 ms |
54608 KB |
Output is correct |
180 |
Correct |
1070 ms |
148980 KB |
Output is correct |
181 |
Correct |
753 ms |
55072 KB |
Output is correct |
182 |
Correct |
714 ms |
54716 KB |
Output is correct |
183 |
Correct |
924 ms |
130952 KB |
Output is correct |
184 |
Correct |
1033 ms |
130792 KB |
Output is correct |
185 |
Correct |
1030 ms |
127764 KB |
Output is correct |
186 |
Correct |
993 ms |
121280 KB |
Output is correct |
187 |
Correct |
1022 ms |
96380 KB |
Output is correct |
188 |
Correct |
1030 ms |
188332 KB |
Output is correct |
189 |
Correct |
1034 ms |
221768 KB |
Output is correct |
190 |
Correct |
1041 ms |
149028 KB |
Output is correct |
191 |
Correct |
669 ms |
54428 KB |
Output is correct |
192 |
Correct |
987 ms |
104216 KB |
Output is correct |
193 |
Correct |
1060 ms |
123700 KB |
Output is correct |
194 |
Correct |
716 ms |
55404 KB |
Output is correct |
195 |
Correct |
1002 ms |
376176 KB |
Output is correct |
196 |
Correct |
1105 ms |
391680 KB |
Output is correct |
197 |
Correct |
1207 ms |
435764 KB |
Output is correct |
198 |
Correct |
1104 ms |
374424 KB |
Output is correct |
199 |
Correct |
30 ms |
37204 KB |
Output is correct |
200 |
Correct |
39 ms |
40008 KB |
Output is correct |
201 |
Correct |
33 ms |
35884 KB |
Output is correct |
202 |
Correct |
32 ms |
35112 KB |
Output is correct |
203 |
Correct |
34 ms |
35788 KB |
Output is correct |
204 |
Correct |
31 ms |
33612 KB |
Output is correct |
205 |
Correct |
36 ms |
38832 KB |
Output is correct |
206 |
Correct |
38 ms |
36348 KB |
Output is correct |
207 |
Correct |
32 ms |
33988 KB |
Output is correct |
208 |
Correct |
32 ms |
33672 KB |
Output is correct |
209 |
Correct |
37 ms |
40276 KB |
Output is correct |
210 |
Correct |
42 ms |
40952 KB |
Output is correct |
211 |
Correct |
36 ms |
39216 KB |
Output is correct |
212 |
Correct |
29 ms |
34744 KB |
Output is correct |
213 |
Correct |
33 ms |
34892 KB |
Output is correct |
214 |
Correct |
30 ms |
33532 KB |
Output is correct |
215 |
Correct |
16 ms |
33108 KB |
Output is correct |
216 |
Correct |
16 ms |
33196 KB |
Output is correct |
217 |
Correct |
18 ms |
33748 KB |
Output is correct |
218 |
Correct |
18 ms |
33752 KB |
Output is correct |
219 |
Correct |
17 ms |
33196 KB |
Output is correct |
220 |
Correct |
18 ms |
33748 KB |
Output is correct |
221 |
Correct |
18 ms |
33448 KB |
Output is correct |
222 |
Correct |
17 ms |
33748 KB |
Output is correct |
223 |
Correct |
17 ms |
33804 KB |
Output is correct |
224 |
Correct |
17 ms |
33840 KB |
Output is correct |
225 |
Correct |
17 ms |
33780 KB |
Output is correct |
226 |
Correct |
16 ms |
33356 KB |
Output is correct |
227 |
Correct |
17 ms |
33412 KB |
Output is correct |
228 |
Correct |
17 ms |
33236 KB |
Output is correct |
229 |
Correct |
1055 ms |
198428 KB |
Output is correct |
230 |
Correct |
971 ms |
184344 KB |
Output is correct |
231 |
Correct |
1243 ms |
228504 KB |
Output is correct |
232 |
Correct |
791 ms |
54508 KB |
Output is correct |
233 |
Correct |
708 ms |
52232 KB |
Output is correct |
234 |
Correct |
701 ms |
51324 KB |
Output is correct |
235 |
Correct |
701 ms |
52032 KB |
Output is correct |
236 |
Correct |
1064 ms |
181672 KB |
Output is correct |
237 |
Correct |
516 ms |
52544 KB |
Output is correct |
238 |
Correct |
995 ms |
142620 KB |
Output is correct |
239 |
Correct |
1231 ms |
223044 KB |
Output is correct |
240 |
Correct |
738 ms |
54652 KB |
Output is correct |
241 |
Correct |
655 ms |
52812 KB |
Output is correct |
242 |
Correct |
625 ms |
201500 KB |
Output is correct |
243 |
Correct |
1145 ms |
335620 KB |
Output is correct |
244 |
Correct |
31 ms |
36064 KB |
Output is correct |
245 |
Correct |
36 ms |
37048 KB |
Output is correct |
246 |
Correct |
32 ms |
33692 KB |
Output is correct |
247 |
Correct |
24 ms |
33492 KB |
Output is correct |
248 |
Correct |
30 ms |
33584 KB |
Output is correct |
249 |
Correct |
17 ms |
33364 KB |
Output is correct |
250 |
Correct |
18 ms |
33564 KB |
Output is correct |
251 |
Correct |
18 ms |
33364 KB |
Output is correct |
252 |
Correct |
17 ms |
33192 KB |
Output is correct |
253 |
Correct |
20 ms |
33196 KB |
Output is correct |
254 |
Correct |
303 ms |
45056 KB |
Output is correct |
255 |
Correct |
503 ms |
53244 KB |
Output is correct |
256 |
Correct |
944 ms |
90224 KB |
Output is correct |
257 |
Correct |
1047 ms |
98900 KB |
Output is correct |
258 |
Correct |
1028 ms |
97836 KB |
Output is correct |
259 |
Correct |
535 ms |
54020 KB |
Output is correct |
260 |
Correct |
1084 ms |
238680 KB |
Output is correct |
261 |
Correct |
1056 ms |
234812 KB |
Output is correct |
262 |
Correct |
705 ms |
54336 KB |
Output is correct |
263 |
Correct |
1144 ms |
246416 KB |
Output is correct |
264 |
Correct |
711 ms |
53940 KB |
Output is correct |
265 |
Correct |
698 ms |
52120 KB |
Output is correct |
266 |
Correct |
926 ms |
148800 KB |
Output is correct |
267 |
Correct |
450 ms |
52276 KB |
Output is correct |
268 |
Correct |
1062 ms |
243304 KB |
Output is correct |
269 |
Correct |
1036 ms |
198364 KB |
Output is correct |
270 |
Correct |
649 ms |
54484 KB |
Output is correct |
271 |
Correct |
564 ms |
52932 KB |
Output is correct |
272 |
Correct |
17 ms |
33108 KB |
Output is correct |
273 |
Correct |
952 ms |
339760 KB |
Output is correct |
274 |
Correct |
1051 ms |
373668 KB |
Output is correct |
275 |
Correct |
40 ms |
37424 KB |
Output is correct |
276 |
Correct |
37 ms |
37396 KB |
Output is correct |
277 |
Correct |
30 ms |
33772 KB |
Output is correct |
278 |
Correct |
30 ms |
33640 KB |
Output is correct |
279 |
Correct |
34 ms |
33736 KB |
Output is correct |
280 |
Correct |
431 ms |
51524 KB |
Output is correct |