답안 #526103

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
526103 2022-02-13T18:01:27 Z Urvuk3 꿈 (IOI13_dreaming) C++17
100 / 100
519 ms 47184 KB
#include "dreaming.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long
const ll INF=1e9,LINF=1e18;
#define fi first
#define se second
#define pii pair<int,int>
#define mid ((l+r)/2)
#define sz(a) (int((a).size()))
#define all(a) a.begin(),a.end()
#define endl "\n"
#define PRINT(x) cerr<<#x<<'='<<x<<endl;
#define pb push_back
#define PRINTvec(arr) { cerr<<#arr<<"="; for(auto h:arr) cerr<<h<<" "; cerr<<endl; }

int travelTime(int N, int M, int L, int A[], int B[], int T[]) {
    vector<int> adj[N+1];
    map<pair<int,int>,ll> edge;
    for(int i=0;i<M;i++){
        int u=A[i],v=B[i],w=T[i];
        u++; v++;
        adj[u].pb(v);
        adj[v].pb(u);
        edge[{u,v}]=w;
        edge[{v,u}]=w;
    }
    vector<int> trees[N+1];
    vector<bool> vis(N+1,false);
    int idx=1;
    function<void(int,int)> dfs=[&](int node,int prev){
        vis[node]=true;
        trees[idx].pb(node);
        for(auto v:adj[node]) if(v!=prev) dfs(v,node);
    };

    for(int i=1;i<=N;i++){
        if(!vis[i]){
            dfs(i,-1);
            idx++;
        }
    }
    vector<ll> nadstablo_udaljenost(N+1,0),podstablo_udaljenost1(N+1),podstablo_udaljenost2(N+1);
    vector<ll> udaljenost(N+1);

    function<void(int,int)> dfs1=[&](int node,int prev){
        podstablo_udaljenost1[node]=0; podstablo_udaljenost2[node]=0;
        vector<ll> tmp; tmp.pb(0); tmp.pb(0);
        for(auto v:adj[node]){
            if(v!=prev){
                dfs1(v,node);
                tmp.pb(podstablo_udaljenost1[v]+edge[{node,v}]);
            }
        }
        sort(all(tmp),greater<int>());
        podstablo_udaljenost1[node]=tmp[0]; podstablo_udaljenost2[node]=tmp[1];
    };

    function<void(int,int)> propagate=[&](int node,int prev){
        //cout<<"propagiranje:"<<endl;
        //PRINT(node); PRINT(prev);
        ll mx=0;
        int idx=0;
        for(int i=0;i<sz(adj[node]);i++){
            int v=adj[node][i];
            //PRINT(v);
            if(v==prev) continue;
            //PRINT(mx);
            //cout<<"edge[{"<<node<<","<<v<<"}]="<<edge[{node,v}]<<endl;
            if(idx!=0) nadstablo_udaljenost[v]=max(nadstablo_udaljenost[v],mx+edge[{node,v}]);
            //cout<<"nadstablo_udaljenost["<<v<<"]="<<nadstablo_udaljenost[v]<<endl;
            int tmp_val=podstablo_udaljenost1[v]+edge[{v,node}];
            //PRINT(tmp_val);
            if(mx<tmp_val){
                mx=tmp_val;
            }
            idx++;
        }
        //cout<<endl;
        mx=0;
        idx=0;
        for(int i=sz(adj[node])-1;i>=0;i--){
            int v=adj[node][i];
            //PRINT(v);
            //PRINT(mx);
            if(v==prev) continue;
            if(idx!=0) nadstablo_udaljenost[v]=max(nadstablo_udaljenost[v],mx+edge[{node,v}]);
            //cout<<"nadstablo_udaljenost["<<v<<"]="<<nadstablo_udaljenost[v]<<endl;
            int tmp_val=podstablo_udaljenost1[v]+edge[{v,node}];
            //PRINT(tmp_val);
            if(mx<tmp_val){
                mx=tmp_val;
            }
            idx++;
        } //cout<<endl;
    };

    function<void(int,int)> dfs2=[&](int node,int prev){
        propagate(node,prev);
        //PRINT(node);
        //cout<<"nadstablo_udaljenost["<<node<<"]="<<nadstablo_udaljenost[node]<<endl; cout<<endl;
        if(prev!=-1){
            nadstablo_udaljenost[node]=max(nadstablo_udaljenost[node],nadstablo_udaljenost[prev]+edge[{prev,node}]);
        }
        for(auto v:adj[node]) if(v!=prev) dfs2(v,node);
        udaljenost[node]=max(nadstablo_udaljenost[node],podstablo_udaljenost1[node]);
    };

    vector<pii> all_trees;

    for(int i=1;i<idx;i++){
        int root=trees[i][0];
        dfs1(root,-1);
        dfs2(root,-1);
        int tmp_node=0;
        ll tmp_val=LINF;
        for(auto v:trees[i]){
            if(udaljenost[v]<=tmp_val){
                tmp_val=udaljenost[v]; tmp_node=v;
            }
        }
        all_trees.pb({tmp_val,tmp_node});
    }

    sort(all(all_trees),greater<pair<ll,ll>>());

    for(int i=1;i<sz(all_trees);i++){
        int node=all_trees[i].se;
        int first=all_trees[0].se;
        adj[node].pb(first); adj[first].pb(node);
        edge[{node,first}]=L; edge[{first,node}]=L;
    }

    /*
    int node=0; ll val=LINF;
    for(int i=1;i<idx;i++){
        int root=trees[i][0];
        dfs1(root,-1);
        dfs2(root,-1);
        if(i==1){
            for(auto v:trees[i]){
                if(udaljenost[v]<=val){
                    val=udaljenost[v]; node=v;
                }
            }
        }
        else{
            int tmp_node=0,tmp_val=INF;
            for(auto v:trees[i]){
                if(udaljenost[v]<=tmp_val){
                    tmp_val=udaljenost[v]; tmp_node=v;
                }
            }
            adj[tmp_node].pb(node); adj[node].pb(tmp_node);
            edge[{tmp_node,node}]=L; edge[{node,tmp_node}]=L;
        }
    }
    */

    /*
    for(int i=1;i<idx;i++){
        PRINTvec(trees[i]);
        for(auto v:trees[i]){
            cout<<"nadstablo_udaljenost["<<v<<"]="<<nadstablo_udaljenost[v]<<endl;
            cout<<"podstablo_udaljenost1["<<v<<"]="<<podstablo_udaljenost1[v]<<endl;
            cout<<"podstablo_udaljenost2["<<v<<"]="<<podstablo_udaljenost2[v]<<endl;
            cout<<"udaljenost["<<v<<"]="<<udaljenost[v]<<endl;
            cout<<endl;
        }
        cout<<endl<<endl;
    }
    */

    dfs1(1,-1);
    ll diametar=0;
    for(int node=1;node<=N;node++){
        diametar=max(diametar,podstablo_udaljenost1[node]+podstablo_udaljenost2[node]);
    }
    return diametar;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 361 ms 34796 KB Output is correct
2 Correct 356 ms 33776 KB Output is correct
3 Correct 209 ms 26668 KB Output is correct
4 Correct 26 ms 5268 KB Output is correct
5 Correct 22 ms 3504 KB Output is correct
6 Correct 49 ms 7872 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 135 ms 14780 KB Output is correct
9 Correct 199 ms 21500 KB Output is correct
10 Correct 2 ms 460 KB Output is correct
11 Correct 307 ms 25652 KB Output is correct
12 Correct 387 ms 30072 KB Output is correct
13 Correct 2 ms 560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 0 ms 300 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 361 ms 34796 KB Output is correct
2 Correct 356 ms 33776 KB Output is correct
3 Correct 209 ms 26668 KB Output is correct
4 Correct 26 ms 5268 KB Output is correct
5 Correct 22 ms 3504 KB Output is correct
6 Correct 49 ms 7872 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 135 ms 14780 KB Output is correct
9 Correct 199 ms 21500 KB Output is correct
10 Correct 2 ms 460 KB Output is correct
11 Correct 307 ms 25652 KB Output is correct
12 Correct 387 ms 30072 KB Output is correct
13 Correct 2 ms 560 KB Output is correct
14 Correct 1 ms 292 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 296 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 300 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 300 KB Output is correct
28 Correct 0 ms 300 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 332 KB Output is correct
39 Correct 346 ms 34584 KB Output is correct
40 Correct 343 ms 33896 KB Output is correct
41 Correct 207 ms 26692 KB Output is correct
42 Correct 26 ms 5308 KB Output is correct
43 Correct 1 ms 332 KB Output is correct
44 Correct 0 ms 204 KB Output is correct
45 Correct 0 ms 332 KB Output is correct
46 Correct 1 ms 292 KB Output is correct
47 Correct 1 ms 288 KB Output is correct
48 Correct 1 ms 332 KB Output is correct
49 Correct 0 ms 300 KB Output is correct
50 Correct 1 ms 272 KB Output is correct
51 Correct 1 ms 204 KB Output is correct
52 Correct 1 ms 296 KB Output is correct
53 Correct 1 ms 204 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 1 ms 332 KB Output is correct
56 Correct 1 ms 332 KB Output is correct
57 Correct 482 ms 26792 KB Output is correct
58 Correct 481 ms 26812 KB Output is correct
59 Correct 474 ms 26944 KB Output is correct
60 Correct 488 ms 27164 KB Output is correct
61 Correct 464 ms 27068 KB Output is correct
62 Correct 465 ms 27176 KB Output is correct
63 Correct 476 ms 26940 KB Output is correct
64 Correct 468 ms 26812 KB Output is correct
65 Correct 499 ms 27236 KB Output is correct
66 Correct 477 ms 27320 KB Output is correct
67 Correct 489 ms 26956 KB Output is correct
68 Correct 467 ms 27028 KB Output is correct
69 Correct 493 ms 27328 KB Output is correct
70 Correct 478 ms 27316 KB Output is correct
71 Correct 0 ms 204 KB Output is correct
72 Correct 6 ms 1100 KB Output is correct
73 Correct 6 ms 1100 KB Output is correct
74 Correct 6 ms 1132 KB Output is correct
75 Correct 7 ms 1084 KB Output is correct
76 Correct 7 ms 1116 KB Output is correct
77 Correct 7 ms 1100 KB Output is correct
78 Correct 6 ms 1136 KB Output is correct
79 Correct 6 ms 1100 KB Output is correct
80 Correct 485 ms 27040 KB Output is correct
81 Correct 493 ms 26968 KB Output is correct
82 Correct 465 ms 27088 KB Output is correct
83 Correct 469 ms 27168 KB Output is correct
84 Correct 4 ms 844 KB Output is correct
85 Correct 4 ms 844 KB Output is correct
86 Correct 5 ms 972 KB Output is correct
87 Correct 5 ms 956 KB Output is correct
88 Correct 5 ms 944 KB Output is correct
89 Correct 5 ms 972 KB Output is correct
90 Correct 5 ms 1024 KB Output is correct
91 Correct 6 ms 1100 KB Output is correct
92 Correct 6 ms 972 KB Output is correct
93 Correct 5 ms 972 KB Output is correct
94 Correct 1 ms 332 KB Output is correct
95 Correct 1 ms 332 KB Output is correct
96 Correct 1 ms 332 KB Output is correct
97 Correct 1 ms 332 KB Output is correct
98 Correct 1 ms 332 KB Output is correct
99 Correct 1 ms 332 KB Output is correct
100 Correct 1 ms 332 KB Output is correct
101 Correct 1 ms 332 KB Output is correct
102 Correct 1 ms 332 KB Output is correct
103 Correct 1 ms 332 KB Output is correct
104 Correct 22 ms 3524 KB Output is correct
105 Correct 51 ms 7852 KB Output is correct
106 Correct 1 ms 332 KB Output is correct
107 Correct 132 ms 14788 KB Output is correct
108 Correct 187 ms 21440 KB Output is correct
109 Correct 1 ms 460 KB Output is correct
110 Correct 314 ms 25644 KB Output is correct
111 Correct 362 ms 29908 KB Output is correct
112 Correct 2 ms 588 KB Output is correct
113 Correct 513 ms 47140 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 180 ms 26428 KB Output is correct
2 Correct 184 ms 26560 KB Output is correct
3 Correct 188 ms 26448 KB Output is correct
4 Correct 182 ms 26600 KB Output is correct
5 Correct 182 ms 26368 KB Output is correct
6 Correct 214 ms 28844 KB Output is correct
7 Correct 192 ms 27688 KB Output is correct
8 Correct 173 ms 26036 KB Output is correct
9 Correct 185 ms 26004 KB Output is correct
10 Correct 187 ms 27484 KB Output is correct
11 Correct 1 ms 248 KB Output is correct
12 Correct 91 ms 29620 KB Output is correct
13 Correct 89 ms 29600 KB Output is correct
14 Correct 93 ms 29684 KB Output is correct
15 Correct 87 ms 29636 KB Output is correct
16 Correct 87 ms 29564 KB Output is correct
17 Correct 89 ms 29616 KB Output is correct
18 Correct 88 ms 29520 KB Output is correct
19 Correct 93 ms 29580 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 0 ms 300 KB Output is correct
22 Correct 3 ms 1196 KB Output is correct
23 Correct 87 ms 29604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 292 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 300 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 300 KB Output is correct
15 Correct 0 ms 300 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 2 ms 544 KB Output is correct
27 Correct 4 ms 844 KB Output is correct
28 Correct 5 ms 1076 KB Output is correct
29 Correct 2 ms 460 KB Output is correct
30 Correct 4 ms 844 KB Output is correct
31 Correct 7 ms 1060 KB Output is correct
32 Correct 2 ms 460 KB Output is correct
33 Correct 4 ms 712 KB Output is correct
34 Correct 6 ms 1100 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 1 ms 300 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 332 KB Output is correct
39 Correct 1 ms 332 KB Output is correct
40 Correct 1 ms 300 KB Output is correct
41 Correct 1 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 1 ms 332 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 292 KB Output is correct
46 Correct 1 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 1 ms 332 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 1 ms 292 KB Output is correct
51 Correct 1 ms 296 KB Output is correct
52 Correct 0 ms 204 KB Output is correct
53 Correct 1 ms 204 KB Output is correct
54 Correct 6 ms 1336 KB Output is correct
55 Correct 6 ms 1476 KB Output is correct
56 Correct 5 ms 1100 KB Output is correct
57 Correct 3 ms 1100 KB Output is correct
58 Correct 6 ms 1100 KB Output is correct
59 Correct 6 ms 1116 KB Output is correct
60 Correct 4 ms 1080 KB Output is correct
61 Correct 4 ms 1072 KB Output is correct
62 Correct 7 ms 1112 KB Output is correct
63 Correct 7 ms 1220 KB Output is correct
64 Correct 3 ms 1112 KB Output is correct
65 Correct 5 ms 1228 KB Output is correct
66 Correct 7 ms 1080 KB Output is correct
67 Correct 6 ms 1120 KB Output is correct
68 Correct 5 ms 1100 KB Output is correct
69 Correct 6 ms 1100 KB Output is correct
70 Correct 4 ms 1100 KB Output is correct
71 Correct 4 ms 1100 KB Output is correct
72 Correct 6 ms 1100 KB Output is correct
73 Correct 8 ms 1068 KB Output is correct
74 Correct 6 ms 1068 KB Output is correct
75 Correct 6 ms 988 KB Output is correct
76 Correct 7 ms 1080 KB Output is correct
77 Correct 6 ms 1100 KB Output is correct
78 Correct 4 ms 1100 KB Output is correct
79 Correct 4 ms 1084 KB Output is correct
80 Correct 3 ms 1100 KB Output is correct
81 Correct 3 ms 1104 KB Output is correct
82 Correct 6 ms 1088 KB Output is correct
83 Correct 6 ms 1100 KB Output is correct
84 Correct 4 ms 1080 KB Output is correct
85 Correct 3 ms 1104 KB Output is correct
86 Correct 5 ms 1076 KB Output is correct
87 Correct 9 ms 1104 KB Output is correct
88 Correct 5 ms 1100 KB Output is correct
89 Correct 5 ms 1100 KB Output is correct
90 Correct 4 ms 1096 KB Output is correct
91 Correct 4 ms 1092 KB Output is correct
92 Correct 5 ms 844 KB Output is correct
93 Correct 4 ms 844 KB Output is correct
94 Correct 5 ms 976 KB Output is correct
95 Correct 6 ms 976 KB Output is correct
96 Correct 5 ms 976 KB Output is correct
97 Correct 6 ms 948 KB Output is correct
98 Correct 5 ms 976 KB Output is correct
99 Correct 6 ms 1104 KB Output is correct
100 Correct 6 ms 1040 KB Output is correct
101 Correct 5 ms 980 KB Output is correct
102 Correct 1 ms 332 KB Output is correct
103 Correct 1 ms 340 KB Output is correct
104 Correct 1 ms 304 KB Output is correct
105 Correct 1 ms 340 KB Output is correct
106 Correct 1 ms 340 KB Output is correct
107 Correct 1 ms 340 KB Output is correct
108 Correct 1 ms 340 KB Output is correct
109 Correct 1 ms 340 KB Output is correct
110 Correct 1 ms 308 KB Output is correct
111 Correct 1 ms 308 KB Output is correct
112 Correct 1 ms 340 KB Output is correct
113 Correct 2 ms 468 KB Output is correct
114 Correct 2 ms 596 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 361 ms 34796 KB Output is correct
2 Correct 356 ms 33776 KB Output is correct
3 Correct 209 ms 26668 KB Output is correct
4 Correct 26 ms 5268 KB Output is correct
5 Correct 22 ms 3504 KB Output is correct
6 Correct 49 ms 7872 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 135 ms 14780 KB Output is correct
9 Correct 199 ms 21500 KB Output is correct
10 Correct 2 ms 460 KB Output is correct
11 Correct 307 ms 25652 KB Output is correct
12 Correct 387 ms 30072 KB Output is correct
13 Correct 2 ms 560 KB Output is correct
14 Correct 1 ms 292 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 296 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 332 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 300 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 300 KB Output is correct
28 Correct 0 ms 300 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 1 ms 332 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 332 KB Output is correct
39 Correct 346 ms 34584 KB Output is correct
40 Correct 343 ms 33896 KB Output is correct
41 Correct 207 ms 26692 KB Output is correct
42 Correct 26 ms 5308 KB Output is correct
43 Correct 1 ms 332 KB Output is correct
44 Correct 0 ms 204 KB Output is correct
45 Correct 0 ms 332 KB Output is correct
46 Correct 1 ms 292 KB Output is correct
47 Correct 1 ms 288 KB Output is correct
48 Correct 1 ms 332 KB Output is correct
49 Correct 0 ms 300 KB Output is correct
50 Correct 1 ms 272 KB Output is correct
51 Correct 1 ms 204 KB Output is correct
52 Correct 1 ms 296 KB Output is correct
53 Correct 1 ms 204 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 1 ms 332 KB Output is correct
56 Correct 1 ms 332 KB Output is correct
57 Correct 482 ms 26792 KB Output is correct
58 Correct 481 ms 26812 KB Output is correct
59 Correct 474 ms 26944 KB Output is correct
60 Correct 488 ms 27164 KB Output is correct
61 Correct 464 ms 27068 KB Output is correct
62 Correct 465 ms 27176 KB Output is correct
63 Correct 476 ms 26940 KB Output is correct
64 Correct 468 ms 26812 KB Output is correct
65 Correct 499 ms 27236 KB Output is correct
66 Correct 477 ms 27320 KB Output is correct
67 Correct 489 ms 26956 KB Output is correct
68 Correct 467 ms 27028 KB Output is correct
69 Correct 493 ms 27328 KB Output is correct
70 Correct 478 ms 27316 KB Output is correct
71 Correct 0 ms 204 KB Output is correct
72 Correct 6 ms 1100 KB Output is correct
73 Correct 6 ms 1100 KB Output is correct
74 Correct 6 ms 1132 KB Output is correct
75 Correct 7 ms 1084 KB Output is correct
76 Correct 7 ms 1116 KB Output is correct
77 Correct 7 ms 1100 KB Output is correct
78 Correct 6 ms 1136 KB Output is correct
79 Correct 6 ms 1100 KB Output is correct
80 Correct 485 ms 27040 KB Output is correct
81 Correct 493 ms 26968 KB Output is correct
82 Correct 465 ms 27088 KB Output is correct
83 Correct 469 ms 27168 KB Output is correct
84 Correct 4 ms 844 KB Output is correct
85 Correct 4 ms 844 KB Output is correct
86 Correct 5 ms 972 KB Output is correct
87 Correct 5 ms 956 KB Output is correct
88 Correct 5 ms 944 KB Output is correct
89 Correct 5 ms 972 KB Output is correct
90 Correct 5 ms 1024 KB Output is correct
91 Correct 6 ms 1100 KB Output is correct
92 Correct 6 ms 972 KB Output is correct
93 Correct 5 ms 972 KB Output is correct
94 Correct 1 ms 332 KB Output is correct
95 Correct 1 ms 332 KB Output is correct
96 Correct 1 ms 332 KB Output is correct
97 Correct 1 ms 332 KB Output is correct
98 Correct 1 ms 332 KB Output is correct
99 Correct 1 ms 332 KB Output is correct
100 Correct 1 ms 332 KB Output is correct
101 Correct 1 ms 332 KB Output is correct
102 Correct 1 ms 332 KB Output is correct
103 Correct 1 ms 332 KB Output is correct
104 Correct 22 ms 3524 KB Output is correct
105 Correct 51 ms 7852 KB Output is correct
106 Correct 1 ms 332 KB Output is correct
107 Correct 132 ms 14788 KB Output is correct
108 Correct 187 ms 21440 KB Output is correct
109 Correct 1 ms 460 KB Output is correct
110 Correct 314 ms 25644 KB Output is correct
111 Correct 362 ms 29908 KB Output is correct
112 Correct 2 ms 588 KB Output is correct
113 Correct 513 ms 47140 KB Output is correct
114 Correct 180 ms 26428 KB Output is correct
115 Correct 184 ms 26560 KB Output is correct
116 Correct 188 ms 26448 KB Output is correct
117 Correct 182 ms 26600 KB Output is correct
118 Correct 182 ms 26368 KB Output is correct
119 Correct 214 ms 28844 KB Output is correct
120 Correct 192 ms 27688 KB Output is correct
121 Correct 173 ms 26036 KB Output is correct
122 Correct 185 ms 26004 KB Output is correct
123 Correct 187 ms 27484 KB Output is correct
124 Correct 1 ms 248 KB Output is correct
125 Correct 91 ms 29620 KB Output is correct
126 Correct 89 ms 29600 KB Output is correct
127 Correct 93 ms 29684 KB Output is correct
128 Correct 87 ms 29636 KB Output is correct
129 Correct 87 ms 29564 KB Output is correct
130 Correct 89 ms 29616 KB Output is correct
131 Correct 88 ms 29520 KB Output is correct
132 Correct 93 ms 29580 KB Output is correct
133 Correct 1 ms 204 KB Output is correct
134 Correct 0 ms 300 KB Output is correct
135 Correct 3 ms 1196 KB Output is correct
136 Correct 87 ms 29604 KB Output is correct
137 Correct 2 ms 544 KB Output is correct
138 Correct 4 ms 844 KB Output is correct
139 Correct 5 ms 1076 KB Output is correct
140 Correct 2 ms 460 KB Output is correct
141 Correct 4 ms 844 KB Output is correct
142 Correct 7 ms 1060 KB Output is correct
143 Correct 2 ms 460 KB Output is correct
144 Correct 4 ms 712 KB Output is correct
145 Correct 6 ms 1100 KB Output is correct
146 Correct 0 ms 204 KB Output is correct
147 Correct 1 ms 300 KB Output is correct
148 Correct 1 ms 332 KB Output is correct
149 Correct 1 ms 332 KB Output is correct
150 Correct 1 ms 332 KB Output is correct
151 Correct 1 ms 300 KB Output is correct
152 Correct 1 ms 332 KB Output is correct
153 Correct 1 ms 332 KB Output is correct
154 Correct 1 ms 332 KB Output is correct
155 Correct 1 ms 204 KB Output is correct
156 Correct 1 ms 292 KB Output is correct
157 Correct 1 ms 204 KB Output is correct
158 Correct 1 ms 332 KB Output is correct
159 Correct 1 ms 332 KB Output is correct
160 Correct 1 ms 332 KB Output is correct
161 Correct 1 ms 292 KB Output is correct
162 Correct 1 ms 296 KB Output is correct
163 Correct 0 ms 204 KB Output is correct
164 Correct 1 ms 204 KB Output is correct
165 Correct 6 ms 1336 KB Output is correct
166 Correct 6 ms 1476 KB Output is correct
167 Correct 5 ms 1100 KB Output is correct
168 Correct 3 ms 1100 KB Output is correct
169 Correct 6 ms 1100 KB Output is correct
170 Correct 6 ms 1116 KB Output is correct
171 Correct 4 ms 1080 KB Output is correct
172 Correct 4 ms 1072 KB Output is correct
173 Correct 7 ms 1112 KB Output is correct
174 Correct 7 ms 1220 KB Output is correct
175 Correct 3 ms 1112 KB Output is correct
176 Correct 5 ms 1228 KB Output is correct
177 Correct 7 ms 1080 KB Output is correct
178 Correct 6 ms 1120 KB Output is correct
179 Correct 5 ms 1100 KB Output is correct
180 Correct 6 ms 1100 KB Output is correct
181 Correct 4 ms 1100 KB Output is correct
182 Correct 4 ms 1100 KB Output is correct
183 Correct 6 ms 1100 KB Output is correct
184 Correct 8 ms 1068 KB Output is correct
185 Correct 6 ms 1068 KB Output is correct
186 Correct 6 ms 988 KB Output is correct
187 Correct 7 ms 1080 KB Output is correct
188 Correct 6 ms 1100 KB Output is correct
189 Correct 4 ms 1100 KB Output is correct
190 Correct 4 ms 1084 KB Output is correct
191 Correct 3 ms 1100 KB Output is correct
192 Correct 3 ms 1104 KB Output is correct
193 Correct 6 ms 1088 KB Output is correct
194 Correct 6 ms 1100 KB Output is correct
195 Correct 4 ms 1080 KB Output is correct
196 Correct 3 ms 1104 KB Output is correct
197 Correct 5 ms 1076 KB Output is correct
198 Correct 9 ms 1104 KB Output is correct
199 Correct 5 ms 1100 KB Output is correct
200 Correct 5 ms 1100 KB Output is correct
201 Correct 4 ms 1096 KB Output is correct
202 Correct 4 ms 1092 KB Output is correct
203 Correct 5 ms 844 KB Output is correct
204 Correct 4 ms 844 KB Output is correct
205 Correct 5 ms 976 KB Output is correct
206 Correct 6 ms 976 KB Output is correct
207 Correct 5 ms 976 KB Output is correct
208 Correct 6 ms 948 KB Output is correct
209 Correct 5 ms 976 KB Output is correct
210 Correct 6 ms 1104 KB Output is correct
211 Correct 6 ms 1040 KB Output is correct
212 Correct 5 ms 980 KB Output is correct
213 Correct 1 ms 332 KB Output is correct
214 Correct 1 ms 340 KB Output is correct
215 Correct 1 ms 304 KB Output is correct
216 Correct 1 ms 340 KB Output is correct
217 Correct 1 ms 340 KB Output is correct
218 Correct 1 ms 340 KB Output is correct
219 Correct 1 ms 340 KB Output is correct
220 Correct 1 ms 340 KB Output is correct
221 Correct 1 ms 308 KB Output is correct
222 Correct 1 ms 308 KB Output is correct
223 Correct 1 ms 340 KB Output is correct
224 Correct 2 ms 468 KB Output is correct
225 Correct 2 ms 596 KB Output is correct
226 Correct 2 ms 560 KB Output is correct
227 Correct 4 ms 832 KB Output is correct
228 Correct 6 ms 1112 KB Output is correct
229 Correct 293 ms 22056 KB Output is correct
230 Correct 391 ms 27464 KB Output is correct
231 Correct 2 ms 460 KB Output is correct
232 Correct 4 ms 808 KB Output is correct
233 Correct 6 ms 1052 KB Output is correct
234 Correct 303 ms 22128 KB Output is correct
235 Correct 379 ms 27556 KB Output is correct
236 Correct 2 ms 460 KB Output is correct
237 Correct 4 ms 828 KB Output is correct
238 Correct 6 ms 1076 KB Output is correct
239 Correct 287 ms 22080 KB Output is correct
240 Correct 389 ms 27612 KB Output is correct
241 Correct 195 ms 26484 KB Output is correct
242 Correct 182 ms 26656 KB Output is correct
243 Correct 181 ms 26428 KB Output is correct
244 Correct 183 ms 26572 KB Output is correct
245 Correct 184 ms 26428 KB Output is correct
246 Correct 209 ms 28780 KB Output is correct
247 Correct 188 ms 27744 KB Output is correct
248 Correct 173 ms 26000 KB Output is correct
249 Correct 187 ms 25904 KB Output is correct
250 Correct 189 ms 27456 KB Output is correct
251 Correct 1 ms 204 KB Output is correct
252 Correct 334 ms 34596 KB Output is correct
253 Correct 333 ms 33764 KB Output is correct
254 Correct 187 ms 26620 KB Output is correct
255 Correct 27 ms 5276 KB Output is correct
256 Correct 1 ms 332 KB Output is correct
257 Correct 1 ms 204 KB Output is correct
258 Correct 1 ms 284 KB Output is correct
259 Correct 1 ms 232 KB Output is correct
260 Correct 1 ms 332 KB Output is correct
261 Correct 1 ms 300 KB Output is correct
262 Correct 1 ms 332 KB Output is correct
263 Correct 1 ms 204 KB Output is correct
264 Correct 1 ms 332 KB Output is correct
265 Correct 1 ms 332 KB Output is correct
266 Correct 1 ms 332 KB Output is correct
267 Correct 1 ms 332 KB Output is correct
268 Correct 1 ms 292 KB Output is correct
269 Correct 1 ms 332 KB Output is correct
270 Correct 1 ms 204 KB Output is correct
271 Correct 1 ms 332 KB Output is correct
272 Correct 451 ms 26820 KB Output is correct
273 Correct 476 ms 26852 KB Output is correct
274 Correct 484 ms 27064 KB Output is correct
275 Correct 472 ms 27044 KB Output is correct
276 Correct 88 ms 29668 KB Output is correct
277 Correct 89 ms 29624 KB Output is correct
278 Correct 448 ms 27016 KB Output is correct
279 Correct 449 ms 27188 KB Output is correct
280 Correct 454 ms 26936 KB Output is correct
281 Correct 466 ms 26932 KB Output is correct
282 Correct 475 ms 27196 KB Output is correct
283 Correct 464 ms 27204 KB Output is correct
284 Correct 474 ms 27204 KB Output is correct
285 Correct 471 ms 27040 KB Output is correct
286 Correct 472 ms 27380 KB Output is correct
287 Correct 468 ms 27456 KB Output is correct
288 Correct 87 ms 29624 KB Output is correct
289 Correct 88 ms 29624 KB Output is correct
290 Correct 86 ms 29544 KB Output is correct
291 Correct 96 ms 29628 KB Output is correct
292 Correct 92 ms 29600 KB Output is correct
293 Correct 86 ms 29584 KB Output is correct
294 Correct 0 ms 304 KB Output is correct
295 Correct 0 ms 204 KB Output is correct
296 Correct 6 ms 1388 KB Output is correct
297 Correct 6 ms 1484 KB Output is correct
298 Correct 425 ms 25128 KB Output is correct
299 Correct 402 ms 24624 KB Output is correct
300 Correct 4 ms 1100 KB Output is correct
301 Correct 5 ms 1100 KB Output is correct
302 Correct 7 ms 1132 KB Output is correct
303 Correct 6 ms 1120 KB Output is correct
304 Correct 4 ms 1100 KB Output is correct
305 Correct 4 ms 1100 KB Output is correct
306 Correct 6 ms 980 KB Output is correct
307 Correct 6 ms 1100 KB Output is correct
308 Correct 4 ms 1196 KB Output is correct
309 Correct 5 ms 1100 KB Output is correct
310 Correct 6 ms 1100 KB Output is correct
311 Correct 6 ms 1076 KB Output is correct
312 Correct 5 ms 1100 KB Output is correct
313 Correct 5 ms 1076 KB Output is correct
314 Correct 4 ms 1100 KB Output is correct
315 Correct 4 ms 1100 KB Output is correct
316 Correct 6 ms 1108 KB Output is correct
317 Correct 6 ms 1124 KB Output is correct
318 Correct 6 ms 1108 KB Output is correct
319 Correct 6 ms 1100 KB Output is correct
320 Correct 7 ms 1076 KB Output is correct
321 Correct 6 ms 1080 KB Output is correct
322 Correct 4 ms 1100 KB Output is correct
323 Correct 3 ms 1100 KB Output is correct
324 Correct 3 ms 1100 KB Output is correct
325 Correct 3 ms 1100 KB Output is correct
326 Correct 6 ms 1100 KB Output is correct
327 Correct 6 ms 1120 KB Output is correct
328 Correct 4 ms 1100 KB Output is correct
329 Correct 3 ms 1100 KB Output is correct
330 Correct 5 ms 1100 KB Output is correct
331 Correct 6 ms 1100 KB Output is correct
332 Correct 5 ms 1100 KB Output is correct
333 Correct 4 ms 1144 KB Output is correct
334 Correct 4 ms 1100 KB Output is correct
335 Correct 4 ms 1100 KB Output is correct
336 Correct 440 ms 34544 KB Output is correct
337 Correct 485 ms 41236 KB Output is correct
338 Correct 430 ms 25096 KB Output is correct
339 Correct 442 ms 25608 KB Output is correct
340 Correct 138 ms 29248 KB Output is correct
341 Correct 212 ms 28180 KB Output is correct
342 Correct 470 ms 27044 KB Output is correct
343 Correct 480 ms 27000 KB Output is correct
344 Correct 291 ms 27952 KB Output is correct
345 Correct 185 ms 29008 KB Output is correct
346 Correct 486 ms 27168 KB Output is correct
347 Correct 493 ms 26944 KB Output is correct
348 Correct 403 ms 27164 KB Output is correct
349 Correct 379 ms 27592 KB Output is correct
350 Correct 472 ms 27172 KB Output is correct
351 Correct 454 ms 27112 KB Output is correct
352 Correct 98 ms 29508 KB Output is correct
353 Correct 385 ms 27532 KB Output is correct
354 Correct 184 ms 29144 KB Output is correct
355 Correct 201 ms 29168 KB Output is correct
356 Correct 361 ms 27556 KB Output is correct
357 Correct 118 ms 29468 KB Output is correct
358 Correct 196 ms 29240 KB Output is correct
359 Correct 177 ms 29156 KB Output is correct
360 Correct 90 ms 29540 KB Output is correct
361 Correct 87 ms 29624 KB Output is correct
362 Correct 430 ms 27216 KB Output is correct
363 Correct 444 ms 27436 KB Output is correct
364 Correct 255 ms 28096 KB Output is correct
365 Correct 207 ms 28348 KB Output is correct
366 Correct 289 ms 28296 KB Output is correct
367 Correct 314 ms 28192 KB Output is correct
368 Correct 353 ms 27440 KB Output is correct
369 Correct 298 ms 28216 KB Output is correct
370 Correct 232 ms 28224 KB Output is correct
371 Correct 388 ms 27676 KB Output is correct
372 Correct 4 ms 836 KB Output is correct
373 Correct 4 ms 864 KB Output is correct
374 Correct 5 ms 952 KB Output is correct
375 Correct 5 ms 944 KB Output is correct
376 Correct 5 ms 972 KB Output is correct
377 Correct 5 ms 944 KB Output is correct
378 Correct 6 ms 972 KB Output is correct
379 Correct 8 ms 1100 KB Output is correct
380 Correct 6 ms 972 KB Output is correct
381 Correct 5 ms 972 KB Output is correct
382 Correct 1 ms 332 KB Output is correct
383 Correct 1 ms 280 KB Output is correct
384 Correct 1 ms 300 KB Output is correct
385 Correct 1 ms 332 KB Output is correct
386 Correct 1 ms 332 KB Output is correct
387 Correct 1 ms 332 KB Output is correct
388 Correct 1 ms 332 KB Output is correct
389 Correct 1 ms 332 KB Output is correct
390 Correct 1 ms 332 KB Output is correct
391 Correct 1 ms 332 KB Output is correct
392 Correct 23 ms 3508 KB Output is correct
393 Correct 56 ms 7848 KB Output is correct
394 Correct 1 ms 324 KB Output is correct
395 Correct 132 ms 14752 KB Output is correct
396 Correct 182 ms 21452 KB Output is correct
397 Correct 2 ms 460 KB Output is correct
398 Correct 304 ms 25724 KB Output is correct
399 Correct 389 ms 29976 KB Output is correct
400 Correct 2 ms 588 KB Output is correct
401 Correct 519 ms 47184 KB Output is correct