Submission #59081

# Submission time Handle Problem Language Result Execution time Memory
59081 2018-07-20T12:24:35 Z choikiwon Telegraph (JOI16_telegraph) C++17
100 / 100
154 ms 64268 KB
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

const int MN = 100010;

int N;
int A[MN], C[MN], vis[MN], del[MN];
vector<int> adj[MN], cycle;

ll dfs(int u, int t) {
    vis[u] = 1;
    ll ret = 0;
    ll sum = 0;
    int mx = 0;
    for(int i = 0; i < adj[u].size(); i++) {
        int v = adj[u][i];
        if(del[v]) continue;
        ret += dfs(v, 1);
        sum += C[v];
        mx = max(mx, C[v]);
    }
    if(t) sum -= mx;
    return ret += sum;
}

int main() {
    scanf("%d", &N);

    for(int i = 0; i < N; i++) {
        scanf("%d %d", &A[i], &C[i]);
        A[i]--;
        adj[ A[i] ].push_back(i);
    }

    ll ans = 0;
    for(int i = 0; i < N; i++) {
        if(vis[i]) continue;
        int u = i;
        while(!vis[u]) {
            vis[u] = 1;
            u = A[u];
        }

        cycle.clear();
        int t = u;
        while(1) {
            cycle.push_back(t);
            del[t] = 1;
            t = A[t];
            if(t == u) break;
        }

        int n = cycle.size();
        if(n == N) {
            printf("0");
            return 0;
        }
        ll sum = 0;
        vector<ll> V;
        for(int j = 0; j < n; j++) {
            int u = cycle[j];
            int v = cycle[ (j + n - 1) % n ];
            ll t1 = dfs(u, 1) + C[v];
            ll t2 = dfs(u, 0);
            sum += t2;
            V.push_back(t1 - t2);
        }
        sort(V.begin(), V.end());

        sum += V[0];
        for(int j = 1; j < n; j++) {
            if(V[j] >= 0) break;
            sum += V[j];
        }
        ans += sum;
    }
    printf("%lld", ans);
}

Compilation message

telegraph.cpp: In function 'll dfs(int, int)':
telegraph.cpp:17:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < adj[u].size(); i++) {
                    ~~^~~~~~~~~~~~~~~
telegraph.cpp: In function 'int main()':
telegraph.cpp:29:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
     ~~~~~^~~~~~~~~~
telegraph.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d %d", &A[i], &C[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2808 KB Output is correct
2 Correct 5 ms 2808 KB Output is correct
3 Correct 7 ms 2848 KB Output is correct
4 Correct 5 ms 2856 KB Output is correct
5 Correct 5 ms 3016 KB Output is correct
6 Correct 5 ms 3016 KB Output is correct
7 Correct 4 ms 3072 KB Output is correct
8 Correct 6 ms 3128 KB Output is correct
9 Correct 6 ms 3264 KB Output is correct
10 Correct 6 ms 3264 KB Output is correct
11 Correct 6 ms 3264 KB Output is correct
12 Correct 6 ms 3264 KB Output is correct
13 Correct 4 ms 3264 KB Output is correct
14 Correct 5 ms 3264 KB Output is correct
15 Correct 6 ms 3264 KB Output is correct
16 Correct 5 ms 3264 KB Output is correct
17 Correct 4 ms 3264 KB Output is correct
18 Correct 4 ms 3264 KB Output is correct
19 Correct 4 ms 3264 KB Output is correct
20 Correct 4 ms 3268 KB Output is correct
21 Correct 5 ms 3268 KB Output is correct
22 Correct 7 ms 3268 KB Output is correct
23 Correct 5 ms 3268 KB Output is correct
24 Correct 5 ms 3268 KB Output is correct
25 Correct 6 ms 3268 KB Output is correct
26 Correct 5 ms 3268 KB Output is correct
27 Correct 5 ms 3268 KB Output is correct
28 Correct 6 ms 3268 KB Output is correct
29 Correct 6 ms 3272 KB Output is correct
30 Correct 5 ms 3272 KB Output is correct
31 Correct 5 ms 3420 KB Output is correct
32 Correct 6 ms 3420 KB Output is correct
33 Correct 6 ms 3420 KB Output is correct
34 Correct 6 ms 3420 KB Output is correct
35 Correct 5 ms 3420 KB Output is correct
36 Correct 5 ms 3420 KB Output is correct
37 Correct 7 ms 3420 KB Output is correct
38 Correct 5 ms 3420 KB Output is correct
39 Correct 6 ms 3420 KB Output is correct
40 Correct 7 ms 3420 KB Output is correct
41 Correct 5 ms 3452 KB Output is correct
42 Correct 6 ms 3452 KB Output is correct
43 Correct 6 ms 3452 KB Output is correct
44 Correct 5 ms 3452 KB Output is correct
45 Correct 5 ms 3452 KB Output is correct
46 Correct 5 ms 3452 KB Output is correct
47 Correct 5 ms 3452 KB Output is correct
48 Correct 6 ms 3452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2808 KB Output is correct
2 Correct 5 ms 2808 KB Output is correct
3 Correct 7 ms 2848 KB Output is correct
4 Correct 5 ms 2856 KB Output is correct
5 Correct 5 ms 3016 KB Output is correct
6 Correct 5 ms 3016 KB Output is correct
7 Correct 4 ms 3072 KB Output is correct
8 Correct 6 ms 3128 KB Output is correct
9 Correct 6 ms 3264 KB Output is correct
10 Correct 6 ms 3264 KB Output is correct
11 Correct 6 ms 3264 KB Output is correct
12 Correct 6 ms 3264 KB Output is correct
13 Correct 4 ms 3264 KB Output is correct
14 Correct 5 ms 3264 KB Output is correct
15 Correct 6 ms 3264 KB Output is correct
16 Correct 5 ms 3264 KB Output is correct
17 Correct 4 ms 3264 KB Output is correct
18 Correct 4 ms 3264 KB Output is correct
19 Correct 4 ms 3264 KB Output is correct
20 Correct 4 ms 3268 KB Output is correct
21 Correct 5 ms 3268 KB Output is correct
22 Correct 7 ms 3268 KB Output is correct
23 Correct 5 ms 3268 KB Output is correct
24 Correct 5 ms 3268 KB Output is correct
25 Correct 6 ms 3268 KB Output is correct
26 Correct 5 ms 3268 KB Output is correct
27 Correct 5 ms 3268 KB Output is correct
28 Correct 6 ms 3268 KB Output is correct
29 Correct 6 ms 3272 KB Output is correct
30 Correct 5 ms 3272 KB Output is correct
31 Correct 5 ms 3420 KB Output is correct
32 Correct 6 ms 3420 KB Output is correct
33 Correct 6 ms 3420 KB Output is correct
34 Correct 6 ms 3420 KB Output is correct
35 Correct 5 ms 3420 KB Output is correct
36 Correct 5 ms 3420 KB Output is correct
37 Correct 7 ms 3420 KB Output is correct
38 Correct 5 ms 3420 KB Output is correct
39 Correct 6 ms 3420 KB Output is correct
40 Correct 7 ms 3420 KB Output is correct
41 Correct 5 ms 3452 KB Output is correct
42 Correct 6 ms 3452 KB Output is correct
43 Correct 6 ms 3452 KB Output is correct
44 Correct 5 ms 3452 KB Output is correct
45 Correct 5 ms 3452 KB Output is correct
46 Correct 5 ms 3452 KB Output is correct
47 Correct 5 ms 3452 KB Output is correct
48 Correct 6 ms 3452 KB Output is correct
49 Correct 5 ms 3452 KB Output is correct
50 Correct 5 ms 3452 KB Output is correct
51 Correct 6 ms 3452 KB Output is correct
52 Correct 5 ms 3452 KB Output is correct
53 Correct 5 ms 3500 KB Output is correct
54 Correct 5 ms 3500 KB Output is correct
55 Correct 6 ms 3500 KB Output is correct
56 Correct 6 ms 3500 KB Output is correct
57 Correct 6 ms 3500 KB Output is correct
58 Correct 5 ms 3500 KB Output is correct
59 Correct 5 ms 3500 KB Output is correct
60 Correct 7 ms 3500 KB Output is correct
61 Correct 6 ms 3500 KB Output is correct
62 Correct 5 ms 3500 KB Output is correct
63 Correct 5 ms 3500 KB Output is correct
64 Correct 5 ms 3500 KB Output is correct
65 Correct 5 ms 3500 KB Output is correct
66 Correct 6 ms 3500 KB Output is correct
67 Correct 5 ms 3500 KB Output is correct
68 Correct 5 ms 3500 KB Output is correct
69 Correct 5 ms 3500 KB Output is correct
70 Correct 5 ms 3500 KB Output is correct
71 Correct 5 ms 3500 KB Output is correct
72 Correct 5 ms 3500 KB Output is correct
73 Correct 6 ms 3500 KB Output is correct
74 Correct 6 ms 3500 KB Output is correct
75 Correct 5 ms 3500 KB Output is correct
76 Correct 4 ms 3504 KB Output is correct
77 Correct 6 ms 3508 KB Output is correct
78 Correct 5 ms 3512 KB Output is correct
79 Correct 7 ms 3512 KB Output is correct
80 Correct 5 ms 3520 KB Output is correct
81 Correct 5 ms 3524 KB Output is correct
82 Correct 5 ms 3528 KB Output is correct
83 Correct 5 ms 3532 KB Output is correct
84 Correct 5 ms 3540 KB Output is correct
85 Correct 5 ms 3544 KB Output is correct
86 Correct 6 ms 3548 KB Output is correct
87 Correct 7 ms 3552 KB Output is correct
88 Correct 6 ms 3560 KB Output is correct
89 Correct 6 ms 3560 KB Output is correct
90 Correct 5 ms 3564 KB Output is correct
91 Correct 6 ms 3568 KB Output is correct
92 Correct 5 ms 3572 KB Output is correct
93 Correct 6 ms 3576 KB Output is correct
94 Correct 5 ms 3580 KB Output is correct
95 Correct 5 ms 3584 KB Output is correct
96 Correct 4 ms 3588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2808 KB Output is correct
2 Correct 5 ms 2808 KB Output is correct
3 Correct 7 ms 2848 KB Output is correct
4 Correct 5 ms 2856 KB Output is correct
5 Correct 5 ms 3016 KB Output is correct
6 Correct 5 ms 3016 KB Output is correct
7 Correct 4 ms 3072 KB Output is correct
8 Correct 6 ms 3128 KB Output is correct
9 Correct 6 ms 3264 KB Output is correct
10 Correct 6 ms 3264 KB Output is correct
11 Correct 6 ms 3264 KB Output is correct
12 Correct 6 ms 3264 KB Output is correct
13 Correct 4 ms 3264 KB Output is correct
14 Correct 5 ms 3264 KB Output is correct
15 Correct 6 ms 3264 KB Output is correct
16 Correct 5 ms 3264 KB Output is correct
17 Correct 4 ms 3264 KB Output is correct
18 Correct 4 ms 3264 KB Output is correct
19 Correct 4 ms 3264 KB Output is correct
20 Correct 4 ms 3268 KB Output is correct
21 Correct 5 ms 3268 KB Output is correct
22 Correct 7 ms 3268 KB Output is correct
23 Correct 5 ms 3268 KB Output is correct
24 Correct 5 ms 3268 KB Output is correct
25 Correct 6 ms 3268 KB Output is correct
26 Correct 5 ms 3268 KB Output is correct
27 Correct 5 ms 3268 KB Output is correct
28 Correct 6 ms 3268 KB Output is correct
29 Correct 6 ms 3272 KB Output is correct
30 Correct 5 ms 3272 KB Output is correct
31 Correct 5 ms 3420 KB Output is correct
32 Correct 6 ms 3420 KB Output is correct
33 Correct 6 ms 3420 KB Output is correct
34 Correct 6 ms 3420 KB Output is correct
35 Correct 5 ms 3420 KB Output is correct
36 Correct 5 ms 3420 KB Output is correct
37 Correct 7 ms 3420 KB Output is correct
38 Correct 5 ms 3420 KB Output is correct
39 Correct 6 ms 3420 KB Output is correct
40 Correct 7 ms 3420 KB Output is correct
41 Correct 5 ms 3452 KB Output is correct
42 Correct 6 ms 3452 KB Output is correct
43 Correct 6 ms 3452 KB Output is correct
44 Correct 5 ms 3452 KB Output is correct
45 Correct 5 ms 3452 KB Output is correct
46 Correct 5 ms 3452 KB Output is correct
47 Correct 5 ms 3452 KB Output is correct
48 Correct 6 ms 3452 KB Output is correct
49 Correct 5 ms 3452 KB Output is correct
50 Correct 5 ms 3452 KB Output is correct
51 Correct 6 ms 3452 KB Output is correct
52 Correct 5 ms 3452 KB Output is correct
53 Correct 5 ms 3500 KB Output is correct
54 Correct 5 ms 3500 KB Output is correct
55 Correct 6 ms 3500 KB Output is correct
56 Correct 6 ms 3500 KB Output is correct
57 Correct 6 ms 3500 KB Output is correct
58 Correct 5 ms 3500 KB Output is correct
59 Correct 5 ms 3500 KB Output is correct
60 Correct 7 ms 3500 KB Output is correct
61 Correct 6 ms 3500 KB Output is correct
62 Correct 5 ms 3500 KB Output is correct
63 Correct 5 ms 3500 KB Output is correct
64 Correct 5 ms 3500 KB Output is correct
65 Correct 5 ms 3500 KB Output is correct
66 Correct 6 ms 3500 KB Output is correct
67 Correct 5 ms 3500 KB Output is correct
68 Correct 5 ms 3500 KB Output is correct
69 Correct 5 ms 3500 KB Output is correct
70 Correct 5 ms 3500 KB Output is correct
71 Correct 5 ms 3500 KB Output is correct
72 Correct 5 ms 3500 KB Output is correct
73 Correct 6 ms 3500 KB Output is correct
74 Correct 6 ms 3500 KB Output is correct
75 Correct 5 ms 3500 KB Output is correct
76 Correct 4 ms 3504 KB Output is correct
77 Correct 6 ms 3508 KB Output is correct
78 Correct 5 ms 3512 KB Output is correct
79 Correct 7 ms 3512 KB Output is correct
80 Correct 5 ms 3520 KB Output is correct
81 Correct 5 ms 3524 KB Output is correct
82 Correct 5 ms 3528 KB Output is correct
83 Correct 5 ms 3532 KB Output is correct
84 Correct 5 ms 3540 KB Output is correct
85 Correct 5 ms 3544 KB Output is correct
86 Correct 6 ms 3548 KB Output is correct
87 Correct 7 ms 3552 KB Output is correct
88 Correct 6 ms 3560 KB Output is correct
89 Correct 6 ms 3560 KB Output is correct
90 Correct 5 ms 3564 KB Output is correct
91 Correct 6 ms 3568 KB Output is correct
92 Correct 5 ms 3572 KB Output is correct
93 Correct 6 ms 3576 KB Output is correct
94 Correct 5 ms 3580 KB Output is correct
95 Correct 5 ms 3584 KB Output is correct
96 Correct 4 ms 3588 KB Output is correct
97 Correct 7 ms 3720 KB Output is correct
98 Correct 8 ms 3764 KB Output is correct
99 Correct 8 ms 3824 KB Output is correct
100 Correct 8 ms 3868 KB Output is correct
101 Correct 7 ms 3964 KB Output is correct
102 Correct 7 ms 4052 KB Output is correct
103 Correct 7 ms 4128 KB Output is correct
104 Correct 9 ms 4164 KB Output is correct
105 Correct 8 ms 4216 KB Output is correct
106 Correct 8 ms 4276 KB Output is correct
107 Correct 10 ms 4276 KB Output is correct
108 Correct 9 ms 4276 KB Output is correct
109 Correct 9 ms 4280 KB Output is correct
110 Correct 8 ms 4480 KB Output is correct
111 Correct 6 ms 4480 KB Output is correct
112 Correct 8 ms 4480 KB Output is correct
113 Correct 7 ms 4488 KB Output is correct
114 Correct 7 ms 4548 KB Output is correct
115 Correct 9 ms 4568 KB Output is correct
116 Correct 9 ms 4632 KB Output is correct
117 Correct 7 ms 4636 KB Output is correct
118 Correct 7 ms 4804 KB Output is correct
119 Correct 8 ms 4848 KB Output is correct
120 Correct 8 ms 4848 KB Output is correct
121 Correct 8 ms 4848 KB Output is correct
122 Correct 7 ms 4848 KB Output is correct
123 Correct 6 ms 4848 KB Output is correct
124 Correct 7 ms 4848 KB Output is correct
125 Correct 8 ms 4864 KB Output is correct
126 Correct 6 ms 4884 KB Output is correct
127 Correct 8 ms 4920 KB Output is correct
128 Correct 5 ms 4940 KB Output is correct
129 Correct 6 ms 5000 KB Output is correct
130 Correct 6 ms 5132 KB Output is correct
131 Correct 8 ms 5132 KB Output is correct
132 Correct 7 ms 5132 KB Output is correct
133 Correct 7 ms 5168 KB Output is correct
134 Correct 7 ms 5168 KB Output is correct
135 Correct 8 ms 5168 KB Output is correct
136 Correct 8 ms 5204 KB Output is correct
137 Correct 7 ms 5204 KB Output is correct
138 Correct 9 ms 5204 KB Output is correct
139 Correct 7 ms 5204 KB Output is correct
140 Correct 7 ms 5204 KB Output is correct
141 Correct 8 ms 5324 KB Output is correct
142 Correct 5 ms 5324 KB Output is correct
143 Correct 7 ms 5324 KB Output is correct
144 Correct 6 ms 5508 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2808 KB Output is correct
2 Correct 5 ms 2808 KB Output is correct
3 Correct 7 ms 2848 KB Output is correct
4 Correct 5 ms 2856 KB Output is correct
5 Correct 5 ms 3016 KB Output is correct
6 Correct 5 ms 3016 KB Output is correct
7 Correct 4 ms 3072 KB Output is correct
8 Correct 6 ms 3128 KB Output is correct
9 Correct 6 ms 3264 KB Output is correct
10 Correct 6 ms 3264 KB Output is correct
11 Correct 6 ms 3264 KB Output is correct
12 Correct 6 ms 3264 KB Output is correct
13 Correct 4 ms 3264 KB Output is correct
14 Correct 5 ms 3264 KB Output is correct
15 Correct 6 ms 3264 KB Output is correct
16 Correct 5 ms 3264 KB Output is correct
17 Correct 4 ms 3264 KB Output is correct
18 Correct 4 ms 3264 KB Output is correct
19 Correct 4 ms 3264 KB Output is correct
20 Correct 4 ms 3268 KB Output is correct
21 Correct 5 ms 3268 KB Output is correct
22 Correct 7 ms 3268 KB Output is correct
23 Correct 5 ms 3268 KB Output is correct
24 Correct 5 ms 3268 KB Output is correct
25 Correct 6 ms 3268 KB Output is correct
26 Correct 5 ms 3268 KB Output is correct
27 Correct 5 ms 3268 KB Output is correct
28 Correct 6 ms 3268 KB Output is correct
29 Correct 6 ms 3272 KB Output is correct
30 Correct 5 ms 3272 KB Output is correct
31 Correct 5 ms 3420 KB Output is correct
32 Correct 6 ms 3420 KB Output is correct
33 Correct 6 ms 3420 KB Output is correct
34 Correct 6 ms 3420 KB Output is correct
35 Correct 5 ms 3420 KB Output is correct
36 Correct 5 ms 3420 KB Output is correct
37 Correct 7 ms 3420 KB Output is correct
38 Correct 5 ms 3420 KB Output is correct
39 Correct 6 ms 3420 KB Output is correct
40 Correct 7 ms 3420 KB Output is correct
41 Correct 5 ms 3452 KB Output is correct
42 Correct 6 ms 3452 KB Output is correct
43 Correct 6 ms 3452 KB Output is correct
44 Correct 5 ms 3452 KB Output is correct
45 Correct 5 ms 3452 KB Output is correct
46 Correct 5 ms 3452 KB Output is correct
47 Correct 5 ms 3452 KB Output is correct
48 Correct 6 ms 3452 KB Output is correct
49 Correct 5 ms 3452 KB Output is correct
50 Correct 5 ms 3452 KB Output is correct
51 Correct 6 ms 3452 KB Output is correct
52 Correct 5 ms 3452 KB Output is correct
53 Correct 5 ms 3500 KB Output is correct
54 Correct 5 ms 3500 KB Output is correct
55 Correct 6 ms 3500 KB Output is correct
56 Correct 6 ms 3500 KB Output is correct
57 Correct 6 ms 3500 KB Output is correct
58 Correct 5 ms 3500 KB Output is correct
59 Correct 5 ms 3500 KB Output is correct
60 Correct 7 ms 3500 KB Output is correct
61 Correct 6 ms 3500 KB Output is correct
62 Correct 5 ms 3500 KB Output is correct
63 Correct 5 ms 3500 KB Output is correct
64 Correct 5 ms 3500 KB Output is correct
65 Correct 5 ms 3500 KB Output is correct
66 Correct 6 ms 3500 KB Output is correct
67 Correct 5 ms 3500 KB Output is correct
68 Correct 5 ms 3500 KB Output is correct
69 Correct 5 ms 3500 KB Output is correct
70 Correct 5 ms 3500 KB Output is correct
71 Correct 5 ms 3500 KB Output is correct
72 Correct 5 ms 3500 KB Output is correct
73 Correct 6 ms 3500 KB Output is correct
74 Correct 6 ms 3500 KB Output is correct
75 Correct 5 ms 3500 KB Output is correct
76 Correct 4 ms 3504 KB Output is correct
77 Correct 6 ms 3508 KB Output is correct
78 Correct 5 ms 3512 KB Output is correct
79 Correct 7 ms 3512 KB Output is correct
80 Correct 5 ms 3520 KB Output is correct
81 Correct 5 ms 3524 KB Output is correct
82 Correct 5 ms 3528 KB Output is correct
83 Correct 5 ms 3532 KB Output is correct
84 Correct 5 ms 3540 KB Output is correct
85 Correct 5 ms 3544 KB Output is correct
86 Correct 6 ms 3548 KB Output is correct
87 Correct 7 ms 3552 KB Output is correct
88 Correct 6 ms 3560 KB Output is correct
89 Correct 6 ms 3560 KB Output is correct
90 Correct 5 ms 3564 KB Output is correct
91 Correct 6 ms 3568 KB Output is correct
92 Correct 5 ms 3572 KB Output is correct
93 Correct 6 ms 3576 KB Output is correct
94 Correct 5 ms 3580 KB Output is correct
95 Correct 5 ms 3584 KB Output is correct
96 Correct 4 ms 3588 KB Output is correct
97 Correct 7 ms 3720 KB Output is correct
98 Correct 8 ms 3764 KB Output is correct
99 Correct 8 ms 3824 KB Output is correct
100 Correct 8 ms 3868 KB Output is correct
101 Correct 7 ms 3964 KB Output is correct
102 Correct 7 ms 4052 KB Output is correct
103 Correct 7 ms 4128 KB Output is correct
104 Correct 9 ms 4164 KB Output is correct
105 Correct 8 ms 4216 KB Output is correct
106 Correct 8 ms 4276 KB Output is correct
107 Correct 10 ms 4276 KB Output is correct
108 Correct 9 ms 4276 KB Output is correct
109 Correct 9 ms 4280 KB Output is correct
110 Correct 8 ms 4480 KB Output is correct
111 Correct 6 ms 4480 KB Output is correct
112 Correct 8 ms 4480 KB Output is correct
113 Correct 7 ms 4488 KB Output is correct
114 Correct 7 ms 4548 KB Output is correct
115 Correct 9 ms 4568 KB Output is correct
116 Correct 9 ms 4632 KB Output is correct
117 Correct 7 ms 4636 KB Output is correct
118 Correct 7 ms 4804 KB Output is correct
119 Correct 8 ms 4848 KB Output is correct
120 Correct 8 ms 4848 KB Output is correct
121 Correct 8 ms 4848 KB Output is correct
122 Correct 7 ms 4848 KB Output is correct
123 Correct 6 ms 4848 KB Output is correct
124 Correct 7 ms 4848 KB Output is correct
125 Correct 8 ms 4864 KB Output is correct
126 Correct 6 ms 4884 KB Output is correct
127 Correct 8 ms 4920 KB Output is correct
128 Correct 5 ms 4940 KB Output is correct
129 Correct 6 ms 5000 KB Output is correct
130 Correct 6 ms 5132 KB Output is correct
131 Correct 8 ms 5132 KB Output is correct
132 Correct 7 ms 5132 KB Output is correct
133 Correct 7 ms 5168 KB Output is correct
134 Correct 7 ms 5168 KB Output is correct
135 Correct 8 ms 5168 KB Output is correct
136 Correct 8 ms 5204 KB Output is correct
137 Correct 7 ms 5204 KB Output is correct
138 Correct 9 ms 5204 KB Output is correct
139 Correct 7 ms 5204 KB Output is correct
140 Correct 7 ms 5204 KB Output is correct
141 Correct 8 ms 5324 KB Output is correct
142 Correct 5 ms 5324 KB Output is correct
143 Correct 7 ms 5324 KB Output is correct
144 Correct 6 ms 5508 KB Output is correct
145 Correct 114 ms 10392 KB Output is correct
146 Correct 121 ms 11952 KB Output is correct
147 Correct 108 ms 13460 KB Output is correct
148 Correct 154 ms 15036 KB Output is correct
149 Correct 114 ms 16640 KB Output is correct
150 Correct 79 ms 19924 KB Output is correct
151 Correct 90 ms 21460 KB Output is correct
152 Correct 83 ms 23116 KB Output is correct
153 Correct 84 ms 24592 KB Output is correct
154 Correct 84 ms 26096 KB Output is correct
155 Correct 103 ms 26224 KB Output is correct
156 Correct 112 ms 27828 KB Output is correct
157 Correct 115 ms 29340 KB Output is correct
158 Correct 96 ms 30940 KB Output is correct
159 Correct 100 ms 32544 KB Output is correct
160 Correct 108 ms 33976 KB Output is correct
161 Correct 112 ms 35516 KB Output is correct
162 Correct 93 ms 36348 KB Output is correct
163 Correct 81 ms 37104 KB Output is correct
164 Correct 110 ms 39264 KB Output is correct
165 Correct 118 ms 40924 KB Output is correct
166 Correct 95 ms 43476 KB Output is correct
167 Correct 96 ms 45040 KB Output is correct
168 Correct 119 ms 45040 KB Output is correct
169 Correct 112 ms 45040 KB Output is correct
170 Correct 104 ms 45336 KB Output is correct
171 Correct 101 ms 45984 KB Output is correct
172 Correct 111 ms 46624 KB Output is correct
173 Correct 107 ms 47396 KB Output is correct
174 Correct 96 ms 48452 KB Output is correct
175 Correct 123 ms 49100 KB Output is correct
176 Correct 112 ms 49872 KB Output is correct
177 Correct 101 ms 53280 KB Output is correct
178 Correct 75 ms 54116 KB Output is correct
179 Correct 94 ms 54896 KB Output is correct
180 Correct 103 ms 55628 KB Output is correct
181 Correct 44 ms 55628 KB Output is correct
182 Correct 38 ms 55628 KB Output is correct
183 Correct 102 ms 58788 KB Output is correct
184 Correct 110 ms 60448 KB Output is correct
185 Correct 74 ms 60448 KB Output is correct
186 Correct 66 ms 60448 KB Output is correct
187 Correct 31 ms 60448 KB Output is correct
188 Correct 102 ms 62940 KB Output is correct
189 Correct 102 ms 63104 KB Output is correct
190 Correct 44 ms 64268 KB Output is correct
191 Correct 29 ms 64268 KB Output is correct
192 Correct 9 ms 64268 KB Output is correct