//#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long llo;
#define mp make_pair
#define pb push_back
#define a first
#define b second
#define endl '\n'
#include "roads.h"
#include <vector>
vector<pair<llo,llo>> adj[100001];
vector<pair<llo,llo>> adj2[100001];
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define ord tree<llo,null_type,less<llo>,rb_tree_tag,tree_order_statistics_node_update>
llo val[100001];
llo dp[100001][2];
vector<llo> tt[100001];
llo kk=-1;
llo vis[100001];
vector<llo> xx;
map<pair<llo,llo>,llo> ind;
vector<llo> tree2[100001];
vector<pair<pair<llo,llo>,llo>> pre[100001];
vector<llo> pre2[100001];
ord pre3[100001];
void update(llo zz,llo no,llo l,llo r,llo i,llo j){
if(l==r){
tree2[zz][no]=j;
}
else{
llo mid=(l+r)/2;
if(i<=mid){
update(zz,no*2+1,l,mid,i,j);
}
else{
update(zz,no*2+2,mid+1,r,i,j);
}
tree2[zz][no]=tree2[zz][no*2+1]+tree2[zz][no*2+2];
}
}
llo query(llo zz,llo no,llo l,llo r,llo aa,llo bb){
if(r<aa or l>bb){
return 0;
}
if(aa<=l and r<=bb){
return tree2[zz][no];
}
else{
llo mid=(l+r)/2;
return query(zz,no*2+1,l,mid,aa,bb)+query(zz,no*2+2,mid+1,r,aa,bb);
}
}
void dfs(llo no,llo par2=-1,llo ba=-1){
vector<llo> ss;
llo su=0;
vis[no]=1;
vector<pair<llo,llo>> ne;
vector<llo> tt;
for(auto j:adj2[no]){
if(j.a!=par2){
if(adj[j.a].size()<kk){
// ne.pb(j);
// tt.pb(j.b);
continue;
}
ne.pb(j);
dfs(j.a,no,j.b);
su+=dp[j.a][0];//not removed
ss.pb(dp[j.a][1]-dp[j.a][0]);
//ss.pb(j.a);
}
else{
ne.pb(j);
}
}
adj2[no]=ne;
//cout<<no<<"::"<<ss.size()<<endl;
/*for(auto j:tt[no]){
ss.pb(j);
}*/
sort(ss.begin(),ss.end());
//sort(tt.begin(),tt.end());
dp[no][0]=1e14;
dp[no][1]=1e14;
for(llo i=0;i<2;i++){
if(i==1 and par2==-1){
continue;
}
llo nee=0;
//cout<<11<<endl;
for(llo ii=0;ii<=ss.size();ii++){
if(ii>0){
nee+=ss[ii-1];
}
llo ka=0;
llo le=ss.size()+pre3[no].size();
if(par2>=0 and i==0){
le++;
}
/*if(kk>1){
cout<<le<<"///"<<endl;
}
*/
le-=kk;
le-=ii;
/*if(le>0){
continue;
}*/
/*if(kk>1){
cout<<le<<"///"<<endl;
}
if(kk>1){
cout<<endl;
cout<<no<<":"<<le<<":"<<pre3[no].size()<<endl;
for(auto j:pre3[no]){
cout<<j<<"...";
}
cout<<endl;
//cout<<ka<<"!"<<endl;
//cout<<ind5<<".."<<endl;
}*/
if(le>(llo)pre3[no].size()){
//dp[no][i]=ba+su;
continue;
}
ka=su+nee;
/* for(llo j=0;j<le;j++){
ka+=ss[j];
}*/
if(le>0){
/*for(int j=0;j<le;j++){
ka+=tt[j];
}*/
llo ind5=*pre3[no].find_by_order(le-1);
ka+=query(no,0,0,adj[no].size()-1,0,ind5);
/*for(int j=0;j<=ind5;j++){
ka+=query(no,0,0,adj[no].size()-1,j,j);
}*/
//ka+=query(no,0,0,adj[no].size()-1,0,ind5);
/*if(kk>1 ){
cout<<111<<":"<<ind5<<endl;
cout<<query(no,0,0,adj[no].size()-1,0,ind5)<<endl;
}*/
}
if(i==1){
ka+=ba;
}
//cout<<pre3[no].size()<<"..."<<endl;
/*if(kk==1 and no==0){
cout<<no<<":"<<i<<","<<ii<<":"<<ka<<endl;
}*/
dp[no][i]=min(dp[no][i],ka);
}
}
dp[no][0]=min(dp[no][0],dp[no][1]);
/*if(kk==1){
cout<<no<<":"<<dp[no][0]<<":"<<dp[no][1]<<endl;
}*/
}
vector<llo> minimum_closure_costs(int n,vector<int> aa,
vector<int> bb,
vector<int> cc) {
vector<llo> ans;
vector<llo> dd;
for(llo i=0;i<n-1;i++){
adj[aa[i]].pb({bb[i],cc[i]});
adj[bb[i]].pb({aa[i],cc[i]});
adj2[aa[i]].pb({bb[i],cc[i]});
adj2[bb[i]].pb({aa[i],cc[i]});
dd.pb(cc[i]);
}
//dfs(0);
llo cot=0;
for(llo i=0;i<n;i++){
vector<pair<llo,llo>> dd;
for(auto j:adj[i]){
dd.pb({j.b,j.a});
}
sort(dd.begin(),dd.end());
llo yy=-1;
for(auto j:dd){
yy++;
ind[{i,j.b}]=yy;
xx.pb(j.a);
}
for(llo j=0;j<4*adj[i].size();j++){
tree2[i].pb(0);
}
//build(0,0,adj[i].size()-1,)
}
for(llo i=0;i<n-1;i++){
cot+=cc[i];
}
for(llo i=0;i<n-1;i++){
llo x=aa[i];
llo y=bb[i];
if(adj[x].size()>adj[y].size()){
swap(x,y);
}
//pre[adj[x].size()].pb({{x,y},cc[i]});
if(adj[x].size()<adj[y].size()){
pre[adj[x].size()+1].pb({{y,cc[i]},ind[{y,x}]});
}
else{
}
}
for(llo i=0;i<n;i++){
pre2[adj[i].size()+1].pb(i);
}
set<llo> cur;
for(llo i=0;i<n;i++){
cur.insert(i);
}
ans.pb(cot);
for(llo i=1;i<=n-1;i++){
for(auto j:pre2[i]){
cur.erase(j);
}
kk=i;
for(auto j:cur){
vis[j]=0;
}
for(auto j:pre[i]){
update(j.a.a,0,0,adj[j.a.a].size()-1,j.b,j.a.b);
pre3[j.a.a].insert(j.b);
}
llo ans2=0;
for(auto j:cur){
if(vis[j]==0){
dfs(j);
ans2+=dp[j][0];
}
//cout<<j<<",";
}
//cout<<endl;
ans.pb(ans2);
}
//ans.pb(cot);
/*for(llo i=0;i<n;i++){
if(i==0){
ans.pb(cot);
continue;
}
kk=i;
for(llo j=0;j<n;j++){
adj2[j].clear();
tt[j].clear();
vis[j]=0;
}
for(llo j=0;j<n;j++){
for(auto k:adj[j]){
if(adj[j].size()>i){
if(adj[k.a].size()>i){
adj2[j].pb(k);
}
else{
tt[j].pb(k.b);
}
}
}
}
llo ans2=0;
for(llo j=0;j<n;j++){
if(adj[j].size()>i){
if(vis[j]==0){
dfs(j);
ans2+=dp[j][0];
}
}
}
//dfs(0);
ans.pb(ans2);
}*/
return ans;
}
Compilation message
roads.cpp: In function 'void dfs(llo, llo, llo)':
roads.cpp:72:22: warning: comparison of integer expressions of different signedness: 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'llo' {aka 'long long int'} [-Wsign-compare]
72 | if(adj[j.a].size()<kk){
| ~~~~~~~~~~~~~~~^~~
roads.cpp:102:18: warning: comparison of integer expressions of different signedness: 'llo' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
102 | for(llo ii=0;ii<=ss.size();ii++){
| ~~^~~~~~~~~~~
roads.cpp: In function 'std::vector<long long int> minimum_closure_costs(int, std::vector<int>, std::vector<int>, std::vector<int>)':
roads.cpp:209:16: warning: comparison of integer expressions of different signedness: 'llo' {aka 'long long int'} and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
209 | for(llo j=0;j<4*adj[i].size();j++){
| ~^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
23684 KB |
Output is correct |
2 |
Correct |
26 ms |
24720 KB |
Output is correct |
3 |
Correct |
29 ms |
24792 KB |
Output is correct |
4 |
Correct |
30 ms |
24772 KB |
Output is correct |
5 |
Correct |
18 ms |
23884 KB |
Output is correct |
6 |
Correct |
22 ms |
23904 KB |
Output is correct |
7 |
Correct |
21 ms |
23820 KB |
Output is correct |
8 |
Correct |
28 ms |
24644 KB |
Output is correct |
9 |
Correct |
27 ms |
24712 KB |
Output is correct |
10 |
Correct |
20 ms |
23868 KB |
Output is correct |
11 |
Correct |
18 ms |
23884 KB |
Output is correct |
12 |
Correct |
259 ms |
52812 KB |
Output is correct |
13 |
Correct |
500 ms |
72716 KB |
Output is correct |
14 |
Correct |
480 ms |
67344 KB |
Output is correct |
15 |
Correct |
528 ms |
71612 KB |
Output is correct |
16 |
Correct |
521 ms |
72360 KB |
Output is correct |
17 |
Correct |
492 ms |
72288 KB |
Output is correct |
18 |
Correct |
18 ms |
23716 KB |
Output is correct |
19 |
Correct |
413 ms |
67904 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
23756 KB |
Output is correct |
2 |
Correct |
233 ms |
84788 KB |
Output is correct |
3 |
Correct |
274 ms |
92584 KB |
Output is correct |
4 |
Correct |
277 ms |
97396 KB |
Output is correct |
5 |
Correct |
296 ms |
97276 KB |
Output is correct |
6 |
Correct |
23 ms |
25052 KB |
Output is correct |
7 |
Correct |
25 ms |
25188 KB |
Output is correct |
8 |
Correct |
21 ms |
24972 KB |
Output is correct |
9 |
Correct |
18 ms |
23836 KB |
Output is correct |
10 |
Correct |
19 ms |
23936 KB |
Output is correct |
11 |
Correct |
20 ms |
23840 KB |
Output is correct |
12 |
Correct |
157 ms |
67828 KB |
Output is correct |
13 |
Correct |
275 ms |
97296 KB |
Output is correct |
14 |
Correct |
20 ms |
23788 KB |
Output is correct |
15 |
Correct |
237 ms |
89972 KB |
Output is correct |
16 |
Correct |
270 ms |
97272 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
23796 KB |
Output is correct |
2 |
Correct |
18 ms |
23796 KB |
Output is correct |
3 |
Correct |
18 ms |
23756 KB |
Output is correct |
4 |
Correct |
18 ms |
23880 KB |
Output is correct |
5 |
Correct |
30 ms |
23888 KB |
Output is correct |
6 |
Correct |
22 ms |
23820 KB |
Output is correct |
7 |
Correct |
18 ms |
23884 KB |
Output is correct |
8 |
Correct |
21 ms |
23812 KB |
Output is correct |
9 |
Correct |
19 ms |
23848 KB |
Output is correct |
10 |
Correct |
20 ms |
23816 KB |
Output is correct |
11 |
Correct |
18 ms |
24024 KB |
Output is correct |
12 |
Correct |
29 ms |
23884 KB |
Output is correct |
13 |
Correct |
18 ms |
23888 KB |
Output is correct |
14 |
Correct |
18 ms |
23884 KB |
Output is correct |
15 |
Correct |
21 ms |
23884 KB |
Output is correct |
16 |
Correct |
20 ms |
23848 KB |
Output is correct |
17 |
Correct |
23 ms |
23844 KB |
Output is correct |
18 |
Correct |
21 ms |
23832 KB |
Output is correct |
19 |
Correct |
19 ms |
23900 KB |
Output is correct |
20 |
Correct |
20 ms |
23884 KB |
Output is correct |
21 |
Correct |
18 ms |
23756 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
23796 KB |
Output is correct |
2 |
Correct |
18 ms |
23796 KB |
Output is correct |
3 |
Correct |
18 ms |
23756 KB |
Output is correct |
4 |
Correct |
18 ms |
23880 KB |
Output is correct |
5 |
Correct |
30 ms |
23888 KB |
Output is correct |
6 |
Correct |
22 ms |
23820 KB |
Output is correct |
7 |
Correct |
18 ms |
23884 KB |
Output is correct |
8 |
Correct |
21 ms |
23812 KB |
Output is correct |
9 |
Correct |
19 ms |
23848 KB |
Output is correct |
10 |
Correct |
20 ms |
23816 KB |
Output is correct |
11 |
Correct |
18 ms |
24024 KB |
Output is correct |
12 |
Correct |
29 ms |
23884 KB |
Output is correct |
13 |
Correct |
18 ms |
23888 KB |
Output is correct |
14 |
Correct |
18 ms |
23884 KB |
Output is correct |
15 |
Correct |
21 ms |
23884 KB |
Output is correct |
16 |
Correct |
20 ms |
23848 KB |
Output is correct |
17 |
Correct |
23 ms |
23844 KB |
Output is correct |
18 |
Correct |
21 ms |
23832 KB |
Output is correct |
19 |
Correct |
19 ms |
23900 KB |
Output is correct |
20 |
Correct |
20 ms |
23884 KB |
Output is correct |
21 |
Correct |
18 ms |
23756 KB |
Output is correct |
22 |
Correct |
18 ms |
23756 KB |
Output is correct |
23 |
Correct |
22 ms |
24340 KB |
Output is correct |
24 |
Correct |
23 ms |
24796 KB |
Output is correct |
25 |
Correct |
22 ms |
24652 KB |
Output is correct |
26 |
Correct |
27 ms |
24756 KB |
Output is correct |
27 |
Correct |
29 ms |
24892 KB |
Output is correct |
28 |
Correct |
26 ms |
24740 KB |
Output is correct |
29 |
Correct |
26 ms |
24716 KB |
Output is correct |
30 |
Correct |
28 ms |
24844 KB |
Output is correct |
31 |
Correct |
26 ms |
24844 KB |
Output is correct |
32 |
Correct |
28 ms |
24780 KB |
Output is correct |
33 |
Correct |
23 ms |
25040 KB |
Output is correct |
34 |
Correct |
26 ms |
25228 KB |
Output is correct |
35 |
Correct |
27 ms |
25108 KB |
Output is correct |
36 |
Correct |
28 ms |
24804 KB |
Output is correct |
37 |
Correct |
26 ms |
24712 KB |
Output is correct |
38 |
Correct |
25 ms |
24816 KB |
Output is correct |
39 |
Correct |
18 ms |
23744 KB |
Output is correct |
40 |
Correct |
19 ms |
23716 KB |
Output is correct |
41 |
Correct |
18 ms |
23812 KB |
Output is correct |
42 |
Correct |
18 ms |
23892 KB |
Output is correct |
43 |
Correct |
22 ms |
23876 KB |
Output is correct |
44 |
Correct |
19 ms |
23872 KB |
Output is correct |
45 |
Correct |
21 ms |
23856 KB |
Output is correct |
46 |
Correct |
20 ms |
23900 KB |
Output is correct |
47 |
Correct |
21 ms |
23820 KB |
Output is correct |
48 |
Correct |
18 ms |
23940 KB |
Output is correct |
49 |
Correct |
19 ms |
23884 KB |
Output is correct |
50 |
Correct |
18 ms |
23784 KB |
Output is correct |
51 |
Correct |
19 ms |
23884 KB |
Output is correct |
52 |
Correct |
19 ms |
23864 KB |
Output is correct |
53 |
Correct |
24 ms |
24628 KB |
Output is correct |
54 |
Correct |
24 ms |
24972 KB |
Output is correct |
55 |
Correct |
25 ms |
24836 KB |
Output is correct |
56 |
Correct |
24 ms |
24624 KB |
Output is correct |
57 |
Correct |
26 ms |
24772 KB |
Output is correct |
58 |
Correct |
19 ms |
23848 KB |
Output is correct |
59 |
Correct |
18 ms |
23884 KB |
Output is correct |
60 |
Correct |
19 ms |
23884 KB |
Output is correct |
61 |
Correct |
19 ms |
23828 KB |
Output is correct |
62 |
Correct |
19 ms |
23812 KB |
Output is correct |
63 |
Correct |
21 ms |
23736 KB |
Output is correct |
64 |
Correct |
23 ms |
24828 KB |
Output is correct |
65 |
Correct |
23 ms |
24780 KB |
Output is correct |
66 |
Correct |
22 ms |
24780 KB |
Output is correct |
67 |
Correct |
23 ms |
24768 KB |
Output is correct |
68 |
Correct |
24 ms |
24824 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
610 ms |
72248 KB |
Output is correct |
2 |
Correct |
543 ms |
71364 KB |
Output is correct |
3 |
Correct |
613 ms |
74988 KB |
Output is correct |
4 |
Correct |
584 ms |
73832 KB |
Output is correct |
5 |
Correct |
534 ms |
75008 KB |
Output is correct |
6 |
Correct |
505 ms |
72148 KB |
Output is correct |
7 |
Correct |
590 ms |
74608 KB |
Output is correct |
8 |
Correct |
447 ms |
68760 KB |
Output is correct |
9 |
Correct |
549 ms |
81548 KB |
Output is correct |
10 |
Correct |
505 ms |
72672 KB |
Output is correct |
11 |
Correct |
567 ms |
74244 KB |
Output is correct |
12 |
Correct |
565 ms |
72452 KB |
Output is correct |
13 |
Correct |
21 ms |
23756 KB |
Output is correct |
14 |
Correct |
229 ms |
89964 KB |
Output is correct |
15 |
Correct |
255 ms |
97364 KB |
Output is correct |
16 |
Correct |
22 ms |
24788 KB |
Output is correct |
17 |
Correct |
22 ms |
24780 KB |
Output is correct |
18 |
Correct |
24 ms |
24940 KB |
Output is correct |
19 |
Correct |
27 ms |
24672 KB |
Output is correct |
20 |
Correct |
25 ms |
24828 KB |
Output is correct |
21 |
Correct |
396 ms |
67912 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
610 ms |
72248 KB |
Output is correct |
2 |
Correct |
543 ms |
71364 KB |
Output is correct |
3 |
Correct |
613 ms |
74988 KB |
Output is correct |
4 |
Correct |
584 ms |
73832 KB |
Output is correct |
5 |
Correct |
534 ms |
75008 KB |
Output is correct |
6 |
Correct |
505 ms |
72148 KB |
Output is correct |
7 |
Correct |
590 ms |
74608 KB |
Output is correct |
8 |
Correct |
447 ms |
68760 KB |
Output is correct |
9 |
Correct |
549 ms |
81548 KB |
Output is correct |
10 |
Correct |
505 ms |
72672 KB |
Output is correct |
11 |
Correct |
567 ms |
74244 KB |
Output is correct |
12 |
Correct |
565 ms |
72452 KB |
Output is correct |
13 |
Correct |
21 ms |
23756 KB |
Output is correct |
14 |
Correct |
229 ms |
89964 KB |
Output is correct |
15 |
Correct |
255 ms |
97364 KB |
Output is correct |
16 |
Correct |
22 ms |
24788 KB |
Output is correct |
17 |
Correct |
22 ms |
24780 KB |
Output is correct |
18 |
Correct |
24 ms |
24940 KB |
Output is correct |
19 |
Correct |
27 ms |
24672 KB |
Output is correct |
20 |
Correct |
25 ms |
24828 KB |
Output is correct |
21 |
Correct |
396 ms |
67912 KB |
Output is correct |
22 |
Correct |
20 ms |
23756 KB |
Output is correct |
23 |
Correct |
20 ms |
23756 KB |
Output is correct |
24 |
Correct |
17 ms |
23756 KB |
Output is correct |
25 |
Correct |
473 ms |
66676 KB |
Output is correct |
26 |
Correct |
410 ms |
62868 KB |
Output is correct |
27 |
Correct |
530 ms |
75056 KB |
Output is correct |
28 |
Correct |
587 ms |
75216 KB |
Output is correct |
29 |
Correct |
523 ms |
71260 KB |
Output is correct |
30 |
Correct |
507 ms |
70524 KB |
Output is correct |
31 |
Correct |
527 ms |
72356 KB |
Output is correct |
32 |
Correct |
550 ms |
70244 KB |
Output is correct |
33 |
Correct |
431 ms |
69800 KB |
Output is correct |
34 |
Correct |
537 ms |
74544 KB |
Output is correct |
35 |
Correct |
533 ms |
83912 KB |
Output is correct |
36 |
Correct |
607 ms |
74280 KB |
Output is correct |
37 |
Correct |
533 ms |
72248 KB |
Output is correct |
38 |
Correct |
169 ms |
67832 KB |
Output is correct |
39 |
Correct |
304 ms |
97260 KB |
Output is correct |
40 |
Correct |
22 ms |
24524 KB |
Output is correct |
41 |
Correct |
21 ms |
24780 KB |
Output is correct |
42 |
Correct |
24 ms |
24780 KB |
Output is correct |
43 |
Correct |
23 ms |
24544 KB |
Output is correct |
44 |
Correct |
27 ms |
24796 KB |
Output is correct |
45 |
Correct |
17 ms |
23828 KB |
Output is correct |
46 |
Correct |
21 ms |
23864 KB |
Output is correct |
47 |
Correct |
20 ms |
23900 KB |
Output is correct |
48 |
Correct |
17 ms |
23800 KB |
Output is correct |
49 |
Correct |
20 ms |
23876 KB |
Output is correct |
50 |
Correct |
273 ms |
53020 KB |
Output is correct |
51 |
Correct |
451 ms |
72692 KB |
Output is correct |
52 |
Correct |
509 ms |
72928 KB |
Output is correct |
53 |
Correct |
548 ms |
71892 KB |
Output is correct |
54 |
Correct |
550 ms |
75072 KB |
Output is correct |
55 |
Correct |
528 ms |
73868 KB |
Output is correct |
56 |
Correct |
531 ms |
75100 KB |
Output is correct |
57 |
Correct |
490 ms |
71968 KB |
Output is correct |
58 |
Correct |
646 ms |
74624 KB |
Output is correct |
59 |
Correct |
419 ms |
68880 KB |
Output is correct |
60 |
Correct |
487 ms |
81548 KB |
Output is correct |
61 |
Correct |
539 ms |
72748 KB |
Output is correct |
62 |
Correct |
561 ms |
74240 KB |
Output is correct |
63 |
Correct |
483 ms |
72572 KB |
Output is correct |
64 |
Correct |
17 ms |
23756 KB |
Output is correct |
65 |
Correct |
263 ms |
89964 KB |
Output is correct |
66 |
Correct |
281 ms |
97276 KB |
Output is correct |
67 |
Correct |
27 ms |
24900 KB |
Output is correct |
68 |
Correct |
26 ms |
24804 KB |
Output is correct |
69 |
Correct |
25 ms |
24820 KB |
Output is correct |
70 |
Correct |
26 ms |
24688 KB |
Output is correct |
71 |
Correct |
28 ms |
24796 KB |
Output is correct |
72 |
Correct |
422 ms |
67968 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
23684 KB |
Output is correct |
2 |
Correct |
26 ms |
24720 KB |
Output is correct |
3 |
Correct |
29 ms |
24792 KB |
Output is correct |
4 |
Correct |
30 ms |
24772 KB |
Output is correct |
5 |
Correct |
18 ms |
23884 KB |
Output is correct |
6 |
Correct |
22 ms |
23904 KB |
Output is correct |
7 |
Correct |
21 ms |
23820 KB |
Output is correct |
8 |
Correct |
28 ms |
24644 KB |
Output is correct |
9 |
Correct |
27 ms |
24712 KB |
Output is correct |
10 |
Correct |
20 ms |
23868 KB |
Output is correct |
11 |
Correct |
18 ms |
23884 KB |
Output is correct |
12 |
Correct |
259 ms |
52812 KB |
Output is correct |
13 |
Correct |
500 ms |
72716 KB |
Output is correct |
14 |
Correct |
480 ms |
67344 KB |
Output is correct |
15 |
Correct |
528 ms |
71612 KB |
Output is correct |
16 |
Correct |
521 ms |
72360 KB |
Output is correct |
17 |
Correct |
492 ms |
72288 KB |
Output is correct |
18 |
Correct |
18 ms |
23716 KB |
Output is correct |
19 |
Correct |
413 ms |
67904 KB |
Output is correct |
20 |
Correct |
18 ms |
23756 KB |
Output is correct |
21 |
Correct |
233 ms |
84788 KB |
Output is correct |
22 |
Correct |
274 ms |
92584 KB |
Output is correct |
23 |
Correct |
277 ms |
97396 KB |
Output is correct |
24 |
Correct |
296 ms |
97276 KB |
Output is correct |
25 |
Correct |
23 ms |
25052 KB |
Output is correct |
26 |
Correct |
25 ms |
25188 KB |
Output is correct |
27 |
Correct |
21 ms |
24972 KB |
Output is correct |
28 |
Correct |
18 ms |
23836 KB |
Output is correct |
29 |
Correct |
19 ms |
23936 KB |
Output is correct |
30 |
Correct |
20 ms |
23840 KB |
Output is correct |
31 |
Correct |
157 ms |
67828 KB |
Output is correct |
32 |
Correct |
275 ms |
97296 KB |
Output is correct |
33 |
Correct |
20 ms |
23788 KB |
Output is correct |
34 |
Correct |
237 ms |
89972 KB |
Output is correct |
35 |
Correct |
270 ms |
97272 KB |
Output is correct |
36 |
Correct |
18 ms |
23796 KB |
Output is correct |
37 |
Correct |
18 ms |
23796 KB |
Output is correct |
38 |
Correct |
18 ms |
23756 KB |
Output is correct |
39 |
Correct |
18 ms |
23880 KB |
Output is correct |
40 |
Correct |
30 ms |
23888 KB |
Output is correct |
41 |
Correct |
22 ms |
23820 KB |
Output is correct |
42 |
Correct |
18 ms |
23884 KB |
Output is correct |
43 |
Correct |
21 ms |
23812 KB |
Output is correct |
44 |
Correct |
19 ms |
23848 KB |
Output is correct |
45 |
Correct |
20 ms |
23816 KB |
Output is correct |
46 |
Correct |
18 ms |
24024 KB |
Output is correct |
47 |
Correct |
29 ms |
23884 KB |
Output is correct |
48 |
Correct |
18 ms |
23888 KB |
Output is correct |
49 |
Correct |
18 ms |
23884 KB |
Output is correct |
50 |
Correct |
21 ms |
23884 KB |
Output is correct |
51 |
Correct |
20 ms |
23848 KB |
Output is correct |
52 |
Correct |
23 ms |
23844 KB |
Output is correct |
53 |
Correct |
21 ms |
23832 KB |
Output is correct |
54 |
Correct |
19 ms |
23900 KB |
Output is correct |
55 |
Correct |
20 ms |
23884 KB |
Output is correct |
56 |
Correct |
18 ms |
23756 KB |
Output is correct |
57 |
Correct |
18 ms |
23756 KB |
Output is correct |
58 |
Correct |
22 ms |
24340 KB |
Output is correct |
59 |
Correct |
23 ms |
24796 KB |
Output is correct |
60 |
Correct |
22 ms |
24652 KB |
Output is correct |
61 |
Correct |
27 ms |
24756 KB |
Output is correct |
62 |
Correct |
29 ms |
24892 KB |
Output is correct |
63 |
Correct |
26 ms |
24740 KB |
Output is correct |
64 |
Correct |
26 ms |
24716 KB |
Output is correct |
65 |
Correct |
28 ms |
24844 KB |
Output is correct |
66 |
Correct |
26 ms |
24844 KB |
Output is correct |
67 |
Correct |
28 ms |
24780 KB |
Output is correct |
68 |
Correct |
23 ms |
25040 KB |
Output is correct |
69 |
Correct |
26 ms |
25228 KB |
Output is correct |
70 |
Correct |
27 ms |
25108 KB |
Output is correct |
71 |
Correct |
28 ms |
24804 KB |
Output is correct |
72 |
Correct |
26 ms |
24712 KB |
Output is correct |
73 |
Correct |
25 ms |
24816 KB |
Output is correct |
74 |
Correct |
18 ms |
23744 KB |
Output is correct |
75 |
Correct |
19 ms |
23716 KB |
Output is correct |
76 |
Correct |
18 ms |
23812 KB |
Output is correct |
77 |
Correct |
18 ms |
23892 KB |
Output is correct |
78 |
Correct |
22 ms |
23876 KB |
Output is correct |
79 |
Correct |
19 ms |
23872 KB |
Output is correct |
80 |
Correct |
21 ms |
23856 KB |
Output is correct |
81 |
Correct |
20 ms |
23900 KB |
Output is correct |
82 |
Correct |
21 ms |
23820 KB |
Output is correct |
83 |
Correct |
18 ms |
23940 KB |
Output is correct |
84 |
Correct |
19 ms |
23884 KB |
Output is correct |
85 |
Correct |
18 ms |
23784 KB |
Output is correct |
86 |
Correct |
19 ms |
23884 KB |
Output is correct |
87 |
Correct |
19 ms |
23864 KB |
Output is correct |
88 |
Correct |
24 ms |
24628 KB |
Output is correct |
89 |
Correct |
24 ms |
24972 KB |
Output is correct |
90 |
Correct |
25 ms |
24836 KB |
Output is correct |
91 |
Correct |
24 ms |
24624 KB |
Output is correct |
92 |
Correct |
26 ms |
24772 KB |
Output is correct |
93 |
Correct |
19 ms |
23848 KB |
Output is correct |
94 |
Correct |
18 ms |
23884 KB |
Output is correct |
95 |
Correct |
19 ms |
23884 KB |
Output is correct |
96 |
Correct |
19 ms |
23828 KB |
Output is correct |
97 |
Correct |
19 ms |
23812 KB |
Output is correct |
98 |
Correct |
21 ms |
23736 KB |
Output is correct |
99 |
Correct |
23 ms |
24828 KB |
Output is correct |
100 |
Correct |
23 ms |
24780 KB |
Output is correct |
101 |
Correct |
22 ms |
24780 KB |
Output is correct |
102 |
Correct |
23 ms |
24768 KB |
Output is correct |
103 |
Correct |
24 ms |
24824 KB |
Output is correct |
104 |
Correct |
610 ms |
72248 KB |
Output is correct |
105 |
Correct |
543 ms |
71364 KB |
Output is correct |
106 |
Correct |
613 ms |
74988 KB |
Output is correct |
107 |
Correct |
584 ms |
73832 KB |
Output is correct |
108 |
Correct |
534 ms |
75008 KB |
Output is correct |
109 |
Correct |
505 ms |
72148 KB |
Output is correct |
110 |
Correct |
590 ms |
74608 KB |
Output is correct |
111 |
Correct |
447 ms |
68760 KB |
Output is correct |
112 |
Correct |
549 ms |
81548 KB |
Output is correct |
113 |
Correct |
505 ms |
72672 KB |
Output is correct |
114 |
Correct |
567 ms |
74244 KB |
Output is correct |
115 |
Correct |
565 ms |
72452 KB |
Output is correct |
116 |
Correct |
21 ms |
23756 KB |
Output is correct |
117 |
Correct |
229 ms |
89964 KB |
Output is correct |
118 |
Correct |
255 ms |
97364 KB |
Output is correct |
119 |
Correct |
22 ms |
24788 KB |
Output is correct |
120 |
Correct |
22 ms |
24780 KB |
Output is correct |
121 |
Correct |
24 ms |
24940 KB |
Output is correct |
122 |
Correct |
27 ms |
24672 KB |
Output is correct |
123 |
Correct |
25 ms |
24828 KB |
Output is correct |
124 |
Correct |
396 ms |
67912 KB |
Output is correct |
125 |
Correct |
20 ms |
23756 KB |
Output is correct |
126 |
Correct |
20 ms |
23756 KB |
Output is correct |
127 |
Correct |
17 ms |
23756 KB |
Output is correct |
128 |
Correct |
473 ms |
66676 KB |
Output is correct |
129 |
Correct |
410 ms |
62868 KB |
Output is correct |
130 |
Correct |
530 ms |
75056 KB |
Output is correct |
131 |
Correct |
587 ms |
75216 KB |
Output is correct |
132 |
Correct |
523 ms |
71260 KB |
Output is correct |
133 |
Correct |
507 ms |
70524 KB |
Output is correct |
134 |
Correct |
527 ms |
72356 KB |
Output is correct |
135 |
Correct |
550 ms |
70244 KB |
Output is correct |
136 |
Correct |
431 ms |
69800 KB |
Output is correct |
137 |
Correct |
537 ms |
74544 KB |
Output is correct |
138 |
Correct |
533 ms |
83912 KB |
Output is correct |
139 |
Correct |
607 ms |
74280 KB |
Output is correct |
140 |
Correct |
533 ms |
72248 KB |
Output is correct |
141 |
Correct |
169 ms |
67832 KB |
Output is correct |
142 |
Correct |
304 ms |
97260 KB |
Output is correct |
143 |
Correct |
22 ms |
24524 KB |
Output is correct |
144 |
Correct |
21 ms |
24780 KB |
Output is correct |
145 |
Correct |
24 ms |
24780 KB |
Output is correct |
146 |
Correct |
23 ms |
24544 KB |
Output is correct |
147 |
Correct |
27 ms |
24796 KB |
Output is correct |
148 |
Correct |
17 ms |
23828 KB |
Output is correct |
149 |
Correct |
21 ms |
23864 KB |
Output is correct |
150 |
Correct |
20 ms |
23900 KB |
Output is correct |
151 |
Correct |
17 ms |
23800 KB |
Output is correct |
152 |
Correct |
20 ms |
23876 KB |
Output is correct |
153 |
Correct |
273 ms |
53020 KB |
Output is correct |
154 |
Correct |
451 ms |
72692 KB |
Output is correct |
155 |
Correct |
509 ms |
72928 KB |
Output is correct |
156 |
Correct |
548 ms |
71892 KB |
Output is correct |
157 |
Correct |
550 ms |
75072 KB |
Output is correct |
158 |
Correct |
528 ms |
73868 KB |
Output is correct |
159 |
Correct |
531 ms |
75100 KB |
Output is correct |
160 |
Correct |
490 ms |
71968 KB |
Output is correct |
161 |
Correct |
646 ms |
74624 KB |
Output is correct |
162 |
Correct |
419 ms |
68880 KB |
Output is correct |
163 |
Correct |
487 ms |
81548 KB |
Output is correct |
164 |
Correct |
539 ms |
72748 KB |
Output is correct |
165 |
Correct |
561 ms |
74240 KB |
Output is correct |
166 |
Correct |
483 ms |
72572 KB |
Output is correct |
167 |
Correct |
17 ms |
23756 KB |
Output is correct |
168 |
Correct |
263 ms |
89964 KB |
Output is correct |
169 |
Correct |
281 ms |
97276 KB |
Output is correct |
170 |
Correct |
27 ms |
24900 KB |
Output is correct |
171 |
Correct |
26 ms |
24804 KB |
Output is correct |
172 |
Correct |
25 ms |
24820 KB |
Output is correct |
173 |
Correct |
26 ms |
24688 KB |
Output is correct |
174 |
Correct |
28 ms |
24796 KB |
Output is correct |
175 |
Correct |
422 ms |
67968 KB |
Output is correct |
176 |
Correct |
16 ms |
23804 KB |
Output is correct |
177 |
Correct |
521 ms |
73208 KB |
Output is correct |
178 |
Correct |
402 ms |
62900 KB |
Output is correct |
179 |
Correct |
620 ms |
75620 KB |
Output is correct |
180 |
Correct |
530 ms |
73180 KB |
Output is correct |
181 |
Correct |
609 ms |
75388 KB |
Output is correct |
182 |
Correct |
557 ms |
74888 KB |
Output is correct |
183 |
Correct |
622 ms |
74520 KB |
Output is correct |
184 |
Correct |
605 ms |
70164 KB |
Output is correct |
185 |
Correct |
526 ms |
70060 KB |
Output is correct |
186 |
Correct |
474 ms |
68296 KB |
Output is correct |
187 |
Correct |
453 ms |
71788 KB |
Output is correct |
188 |
Correct |
508 ms |
71732 KB |
Output is correct |
189 |
Correct |
576 ms |
70696 KB |
Output is correct |
190 |
Correct |
636 ms |
74220 KB |
Output is correct |
191 |
Correct |
501 ms |
74160 KB |
Output is correct |
192 |
Correct |
600 ms |
72232 KB |
Output is correct |
193 |
Correct |
511 ms |
72048 KB |
Output is correct |
194 |
Correct |
540 ms |
74208 KB |
Output is correct |
195 |
Correct |
251 ms |
86388 KB |
Output is correct |
196 |
Correct |
250 ms |
93740 KB |
Output is correct |
197 |
Correct |
269 ms |
97708 KB |
Output is correct |
198 |
Correct |
261 ms |
97288 KB |
Output is correct |
199 |
Correct |
21 ms |
24360 KB |
Output is correct |
200 |
Correct |
31 ms |
24768 KB |
Output is correct |
201 |
Correct |
23 ms |
24692 KB |
Output is correct |
202 |
Correct |
29 ms |
24808 KB |
Output is correct |
203 |
Correct |
25 ms |
24780 KB |
Output is correct |
204 |
Correct |
30 ms |
24788 KB |
Output is correct |
205 |
Correct |
25 ms |
24668 KB |
Output is correct |
206 |
Correct |
28 ms |
24836 KB |
Output is correct |
207 |
Correct |
27 ms |
24728 KB |
Output is correct |
208 |
Correct |
24 ms |
24776 KB |
Output is correct |
209 |
Correct |
27 ms |
25008 KB |
Output is correct |
210 |
Correct |
24 ms |
25236 KB |
Output is correct |
211 |
Correct |
26 ms |
25076 KB |
Output is correct |
212 |
Correct |
26 ms |
24680 KB |
Output is correct |
213 |
Correct |
28 ms |
24768 KB |
Output is correct |
214 |
Correct |
24 ms |
24740 KB |
Output is correct |
215 |
Correct |
21 ms |
23792 KB |
Output is correct |
216 |
Correct |
17 ms |
23788 KB |
Output is correct |
217 |
Correct |
19 ms |
23884 KB |
Output is correct |
218 |
Correct |
16 ms |
23788 KB |
Output is correct |
219 |
Correct |
17 ms |
23796 KB |
Output is correct |
220 |
Correct |
20 ms |
23836 KB |
Output is correct |
221 |
Correct |
21 ms |
23792 KB |
Output is correct |
222 |
Correct |
20 ms |
23884 KB |
Output is correct |
223 |
Correct |
22 ms |
23840 KB |
Output is correct |
224 |
Correct |
20 ms |
23912 KB |
Output is correct |
225 |
Correct |
18 ms |
23880 KB |
Output is correct |
226 |
Correct |
20 ms |
23836 KB |
Output is correct |
227 |
Correct |
18 ms |
23900 KB |
Output is correct |
228 |
Correct |
21 ms |
23812 KB |
Output is correct |
229 |
Correct |
418 ms |
66744 KB |
Output is correct |
230 |
Correct |
430 ms |
62772 KB |
Output is correct |
231 |
Correct |
564 ms |
74848 KB |
Output is correct |
232 |
Correct |
546 ms |
75040 KB |
Output is correct |
233 |
Correct |
468 ms |
71224 KB |
Output is correct |
234 |
Correct |
550 ms |
70148 KB |
Output is correct |
235 |
Correct |
494 ms |
71780 KB |
Output is correct |
236 |
Correct |
488 ms |
71092 KB |
Output is correct |
237 |
Correct |
499 ms |
70972 KB |
Output is correct |
238 |
Correct |
550 ms |
75836 KB |
Output is correct |
239 |
Correct |
540 ms |
85224 KB |
Output is correct |
240 |
Correct |
641 ms |
75632 KB |
Output is correct |
241 |
Correct |
474 ms |
73580 KB |
Output is correct |
242 |
Correct |
179 ms |
68592 KB |
Output is correct |
243 |
Correct |
271 ms |
98708 KB |
Output is correct |
244 |
Correct |
25 ms |
24652 KB |
Output is correct |
245 |
Correct |
22 ms |
24848 KB |
Output is correct |
246 |
Correct |
28 ms |
24720 KB |
Output is correct |
247 |
Correct |
27 ms |
24604 KB |
Output is correct |
248 |
Correct |
24 ms |
24716 KB |
Output is correct |
249 |
Correct |
17 ms |
23756 KB |
Output is correct |
250 |
Correct |
19 ms |
23812 KB |
Output is correct |
251 |
Correct |
21 ms |
23792 KB |
Output is correct |
252 |
Correct |
20 ms |
23824 KB |
Output is correct |
253 |
Correct |
21 ms |
23884 KB |
Output is correct |
254 |
Correct |
260 ms |
52592 KB |
Output is correct |
255 |
Correct |
432 ms |
72328 KB |
Output is correct |
256 |
Correct |
539 ms |
67208 KB |
Output is correct |
257 |
Correct |
466 ms |
73288 KB |
Output is correct |
258 |
Correct |
474 ms |
73980 KB |
Output is correct |
259 |
Correct |
467 ms |
73856 KB |
Output is correct |
260 |
Correct |
495 ms |
73524 KB |
Output is correct |
261 |
Correct |
476 ms |
72668 KB |
Output is correct |
262 |
Correct |
563 ms |
76384 KB |
Output is correct |
263 |
Correct |
531 ms |
75252 KB |
Output is correct |
264 |
Correct |
492 ms |
76416 KB |
Output is correct |
265 |
Correct |
572 ms |
73216 KB |
Output is correct |
266 |
Correct |
622 ms |
76064 KB |
Output is correct |
267 |
Correct |
455 ms |
70088 KB |
Output is correct |
268 |
Correct |
457 ms |
82760 KB |
Output is correct |
269 |
Correct |
562 ms |
73992 KB |
Output is correct |
270 |
Correct |
495 ms |
75492 KB |
Output is correct |
271 |
Correct |
484 ms |
73892 KB |
Output is correct |
272 |
Correct |
17 ms |
23756 KB |
Output is correct |
273 |
Correct |
221 ms |
91188 KB |
Output is correct |
274 |
Correct |
319 ms |
98744 KB |
Output is correct |
275 |
Correct |
22 ms |
24760 KB |
Output is correct |
276 |
Correct |
25 ms |
24756 KB |
Output is correct |
277 |
Correct |
28 ms |
24872 KB |
Output is correct |
278 |
Correct |
27 ms |
24780 KB |
Output is correct |
279 |
Correct |
23 ms |
24780 KB |
Output is correct |
280 |
Correct |
439 ms |
68824 KB |
Output is correct |