Submission #850503

# Submission time Handle Problem Language Result Execution time Memory
850503 2023-09-16T18:21:43 Z eltu0815 Closing Time (IOI23_closing) C++17
100 / 100
348 ms 75924 KB
#include "closing.h"

#include <bits/stdc++.h>
#define MAX 400005
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

int visited[MAX], parent[MAX];
vector<pii> graph[MAX];

ll cost1[MAX], cost2[MAX];
ll dist1[MAX], dist2[MAX];

vector<pair<ll, ll> > vec;
multiset<pair<ll, ll> > st1;
multiset<pair<ll, ll> > st2;

void init(int node, int par) {
    parent[node] = par;
    for(auto [v, w] : graph[node]) if(v != par) init(v, node);
}

void dfs(int node, int par, ll dist[]) {
    for(auto [v, w] : graph[node]) if(v != par) {
        dist[v] = dist[node] + w;
        dfs(v, node, dist);
    }
}

ll c[MAX];
vector<int> path;

int max_score(int N, int X, int Y, long long K, vector<int> U, vector<int> V, vector<int> W)
{
    path.clear();
    for(int i = 0; i < N; ++i) graph[i].clear();
    for(int i = 0; i < N; ++i) dist1[i] = dist2[i] = visited[i] = c[i] = 0;
    for(int i = 0; i < N - 1; ++i) {
        graph[U[i]].push_back({V[i], W[i]});
        graph[V[i]].push_back({U[i], W[i]});
    }
    
    init(0, -1);
    dfs(X, -1, dist1);
    dfs(Y, -1, dist2);
    
    int mx = 0; ll sum = 0;
    priority_queue<pair<ll, int> > pq;
    pq.push({0, X}); pq.push({0, Y});
    while(!pq.empty()) {
        ll d = -pq.top().first;
        int node = pq.top().second;
        pq.pop();
        
        if(sum + d > K) break;
        ++mx; sum += d; visited[node] = 1;
        for(auto [v, w] : graph[node]) {
            if(visited[v]) continue;
            pq.push({-(d + w), v});
        }
    }
    
    int node = X;
    for(int i = 0; i < N; ++i) visited[i] = 0;
    while(node != -1) visited[node]++, node = parent[node];
    
    node = Y; int flag = 0;
    while(node != -1) {
        if(visited[node] == 1 && !flag) flag = 1;
        else if(flag) visited[node]--;
        else visited[node]++;
        node = parent[node];
    }
    
    node = X;
    while(node != -1 && visited[node]) {
        path.push_back(node);
        node = parent[node];
    }
    path.pop_back();
    
    node = Y;
    vector<int> path2;
    while(node != -1 && visited[node]) {
        path2.push_back(node);
        node = parent[node];
    }
    reverse(path2.begin(), path2.end());
    for(auto v : path2) path.push_back(v);
    
    int p = 0, q = path.size() - 1, r = 0; cost1[0] = 0;
    for(int i = 1; i <= 2 * N; ++i) cost1[i] = (ll)(2e18);
    for(int i = 1; i <= 2 * N; ++i) {
        int u = p == (int)path.size() ? -1 : path[p];
        int v = q == -1 ? -1 : path[q];
        
        if(u == -1 && v == -1) break;
        if(u == v) r = i;
        if(u == -1) {
            cost1[i] = cost1[i - 1] + dist2[v] - c[v];
            c[v] = dist2[v]; --q;
        }
        else if(v == -1) {
            cost1[i] = cost1[i - 1] + dist1[u] - c[u];
            c[u] = dist1[u]; ++p;
        }
        else if(dist1[u] - c[u] <= dist2[v] - c[v]) {
            cost1[i] = cost1[i - 1] + dist1[u] - c[u];
            c[u] = dist1[u]; ++p;
        }
        else {
            cost1[i] = cost1[i - 1] + dist2[v] - c[v];
            c[v] = dist2[v]; --q;
        }
    }
    for(int i = 0; i < r; ++i) cost1[i] = (ll)(2e18);
    
    vec.clear(); st1.clear(); st2.clear();
    for(int i = 1; i <= 2 * N; ++i) cost2[i] = (ll)(2e18);
    for(int i = 0; i < N; ++i) if(!visited[i]) {
        ll c1 = min(dist1[i], dist2[i]);
        ll c2 = max(dist1[i], dist2[i]);
        st1.insert({c1, c2}); st2.insert({c2, c1});
    }
    for(int i = 1; i <= 2 * N; ++i) {
        if(st1.empty()) break;
        if(st2.empty() || vec.empty() || vec.back().first + st1.begin()->first <= st2.begin()->first) {
            ll d1 = st1.begin()->first;
            ll d2 = st1.begin()->second;
            st1.erase(st1.begin());
            cost2[i] = cost2[i - 1] + d1;
            vec.push_back({d1, d2});
            
            if(d2 != -1) {
                st1.insert({d2 - d1, -1});
                st2.erase(st2.find({d2, d1}));
            }
        }
        else {
            ll d2 = st2.begin()->first;
            ll d1 = st2.begin()->second;
            cost2[i] = cost2[i - 2] + d2;
            st2.erase(st2.begin());
            
            st1.insert(vec.back());
            st1.erase(st1.find({d1, d2}));
            if(vec.back().second != -1) {
                st1.erase(st1.find({vec.back().second - vec.back().first, -1}));
                st2.insert({vec.back().second, vec.back().first});
            }
            vec.pop_back();
            
            vec.push_back({d1, d2});
            vec.push_back({d2 - d1, -1});
        }
    }
    
//    for(int i = 0; i < N; ++i) cout << cost1[i] << ' ';
//    cout << endl;
//    for(int i = 0; i < N; ++i) cout << cost2[i] << ' ';
//    cout <<endl;
    
    for(int i = 2 * N, p = 0; i >= 0; --i) {
        while(p < 2 * N && cost1[i] + cost2[p + 1] <= K) ++p;
        if(cost1[i] + cost2[p] <= K) mx = max(mx, i + p);
    }
    return mx;
}

/*
4
7 3 2 10
3 1 2
3 0 3
1 2 4
2 4 2
2 5 5
5 6 3

4 0 3 18
0 1 18
1 2 1
2 3 19

8 0 6 100000
1 6 40000
3 6 30000
6 7 30000
1 2 10000
0 2 40000
0 4 100000
0 5 100000

12 0 11 9
0 1 1
1 11 10
1 2 1
2 3 1
3 4 1
4 5 1
5 6 1
6 7 1
7 8 1
8 9 1
9 10 1
*/
# Verdict Execution time Memory Grader output
1 Correct 3 ms 20828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 224 ms 69272 KB Output is correct
2 Correct 150 ms 58404 KB Output is correct
3 Correct 99 ms 23632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 20828 KB Output is correct
2 Correct 4 ms 20828 KB Output is correct
3 Correct 4 ms 20828 KB Output is correct
4 Correct 3 ms 20828 KB Output is correct
5 Correct 4 ms 20828 KB Output is correct
6 Correct 3 ms 20828 KB Output is correct
7 Correct 3 ms 20828 KB Output is correct
8 Correct 3 ms 20828 KB Output is correct
9 Correct 3 ms 20828 KB Output is correct
10 Correct 4 ms 21084 KB Output is correct
11 Correct 3 ms 20828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 20828 KB Output is correct
2 Correct 4 ms 20828 KB Output is correct
3 Correct 4 ms 20828 KB Output is correct
4 Correct 3 ms 20828 KB Output is correct
5 Correct 4 ms 20828 KB Output is correct
6 Correct 3 ms 20828 KB Output is correct
7 Correct 3 ms 20828 KB Output is correct
8 Correct 3 ms 20828 KB Output is correct
9 Correct 3 ms 20828 KB Output is correct
10 Correct 4 ms 21084 KB Output is correct
11 Correct 3 ms 20828 KB Output is correct
12 Correct 3 ms 20824 KB Output is correct
13 Correct 4 ms 20828 KB Output is correct
14 Correct 4 ms 20968 KB Output is correct
15 Correct 4 ms 20828 KB Output is correct
16 Correct 4 ms 20828 KB Output is correct
17 Correct 3 ms 20828 KB Output is correct
18 Correct 3 ms 20828 KB Output is correct
19 Correct 4 ms 21084 KB Output is correct
20 Correct 4 ms 20828 KB Output is correct
21 Correct 4 ms 20828 KB Output is correct
22 Correct 4 ms 20828 KB Output is correct
23 Correct 4 ms 20828 KB Output is correct
24 Correct 3 ms 20824 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 20828 KB Output is correct
2 Correct 4 ms 20828 KB Output is correct
3 Correct 4 ms 20828 KB Output is correct
4 Correct 3 ms 20828 KB Output is correct
5 Correct 4 ms 20828 KB Output is correct
6 Correct 3 ms 20828 KB Output is correct
7 Correct 3 ms 20828 KB Output is correct
8 Correct 3 ms 20828 KB Output is correct
9 Correct 3 ms 20828 KB Output is correct
10 Correct 4 ms 21084 KB Output is correct
11 Correct 3 ms 20828 KB Output is correct
12 Correct 3 ms 20824 KB Output is correct
13 Correct 4 ms 20828 KB Output is correct
14 Correct 4 ms 20968 KB Output is correct
15 Correct 4 ms 20828 KB Output is correct
16 Correct 4 ms 20828 KB Output is correct
17 Correct 3 ms 20828 KB Output is correct
18 Correct 3 ms 20828 KB Output is correct
19 Correct 4 ms 21084 KB Output is correct
20 Correct 4 ms 20828 KB Output is correct
21 Correct 4 ms 20828 KB Output is correct
22 Correct 4 ms 20828 KB Output is correct
23 Correct 4 ms 20828 KB Output is correct
24 Correct 3 ms 20824 KB Output is correct
25 Correct 5 ms 20828 KB Output is correct
26 Correct 6 ms 21596 KB Output is correct
27 Correct 5 ms 21508 KB Output is correct
28 Correct 4 ms 21340 KB Output is correct
29 Correct 5 ms 21340 KB Output is correct
30 Correct 5 ms 21596 KB Output is correct
31 Correct 4 ms 21340 KB Output is correct
32 Correct 5 ms 21188 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 20828 KB Output is correct
2 Correct 4 ms 20828 KB Output is correct
3 Correct 4 ms 20828 KB Output is correct
4 Correct 4 ms 20828 KB Output is correct
5 Correct 3 ms 20828 KB Output is correct
6 Correct 4 ms 20828 KB Output is correct
7 Correct 4 ms 20824 KB Output is correct
8 Correct 3 ms 20920 KB Output is correct
9 Correct 4 ms 20828 KB Output is correct
10 Correct 3 ms 20828 KB Output is correct
11 Correct 3 ms 20828 KB Output is correct
12 Correct 3 ms 20828 KB Output is correct
13 Correct 4 ms 20956 KB Output is correct
14 Correct 3 ms 20828 KB Output is correct
15 Correct 3 ms 20828 KB Output is correct
16 Correct 4 ms 20940 KB Output is correct
17 Correct 3 ms 20828 KB Output is correct
18 Correct 3 ms 20828 KB Output is correct
19 Correct 3 ms 20828 KB Output is correct
20 Correct 3 ms 20824 KB Output is correct
21 Correct 3 ms 20824 KB Output is correct
22 Correct 3 ms 20828 KB Output is correct
23 Correct 3 ms 20932 KB Output is correct
24 Correct 3 ms 20828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 20828 KB Output is correct
2 Correct 4 ms 20828 KB Output is correct
3 Correct 4 ms 20828 KB Output is correct
4 Correct 4 ms 20828 KB Output is correct
5 Correct 3 ms 20828 KB Output is correct
6 Correct 4 ms 20828 KB Output is correct
7 Correct 3 ms 20828 KB Output is correct
8 Correct 3 ms 20828 KB Output is correct
9 Correct 3 ms 20828 KB Output is correct
10 Correct 3 ms 20828 KB Output is correct
11 Correct 4 ms 21084 KB Output is correct
12 Correct 3 ms 20828 KB Output is correct
13 Correct 3 ms 20824 KB Output is correct
14 Correct 4 ms 20828 KB Output is correct
15 Correct 4 ms 20968 KB Output is correct
16 Correct 4 ms 20828 KB Output is correct
17 Correct 4 ms 20828 KB Output is correct
18 Correct 3 ms 20828 KB Output is correct
19 Correct 4 ms 20824 KB Output is correct
20 Correct 3 ms 20920 KB Output is correct
21 Correct 4 ms 20828 KB Output is correct
22 Correct 3 ms 20828 KB Output is correct
23 Correct 3 ms 20828 KB Output is correct
24 Correct 3 ms 20828 KB Output is correct
25 Correct 4 ms 20956 KB Output is correct
26 Correct 3 ms 20828 KB Output is correct
27 Correct 3 ms 20828 KB Output is correct
28 Correct 4 ms 20940 KB Output is correct
29 Correct 3 ms 20828 KB Output is correct
30 Correct 3 ms 20828 KB Output is correct
31 Correct 3 ms 20828 KB Output is correct
32 Correct 3 ms 20824 KB Output is correct
33 Correct 3 ms 20824 KB Output is correct
34 Correct 3 ms 20828 KB Output is correct
35 Correct 3 ms 20932 KB Output is correct
36 Correct 3 ms 20828 KB Output is correct
37 Correct 3 ms 20824 KB Output is correct
38 Correct 3 ms 20828 KB Output is correct
39 Correct 4 ms 20824 KB Output is correct
40 Correct 4 ms 20828 KB Output is correct
41 Correct 3 ms 20828 KB Output is correct
42 Correct 3 ms 20828 KB Output is correct
43 Correct 4 ms 20828 KB Output is correct
44 Correct 4 ms 20828 KB Output is correct
45 Correct 4 ms 21080 KB Output is correct
46 Correct 4 ms 20828 KB Output is correct
47 Correct 3 ms 20828 KB Output is correct
48 Correct 3 ms 20828 KB Output is correct
49 Correct 4 ms 20828 KB Output is correct
50 Correct 3 ms 20828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 20828 KB Output is correct
2 Correct 4 ms 20828 KB Output is correct
3 Correct 4 ms 20828 KB Output is correct
4 Correct 4 ms 20828 KB Output is correct
5 Correct 3 ms 20828 KB Output is correct
6 Correct 4 ms 20828 KB Output is correct
7 Correct 3 ms 20828 KB Output is correct
8 Correct 3 ms 20828 KB Output is correct
9 Correct 3 ms 20828 KB Output is correct
10 Correct 3 ms 20828 KB Output is correct
11 Correct 4 ms 21084 KB Output is correct
12 Correct 3 ms 20828 KB Output is correct
13 Correct 3 ms 20824 KB Output is correct
14 Correct 4 ms 20828 KB Output is correct
15 Correct 4 ms 20968 KB Output is correct
16 Correct 4 ms 20828 KB Output is correct
17 Correct 4 ms 20828 KB Output is correct
18 Correct 3 ms 20828 KB Output is correct
19 Correct 3 ms 20828 KB Output is correct
20 Correct 4 ms 21084 KB Output is correct
21 Correct 4 ms 20828 KB Output is correct
22 Correct 4 ms 20828 KB Output is correct
23 Correct 4 ms 20828 KB Output is correct
24 Correct 4 ms 20828 KB Output is correct
25 Correct 3 ms 20824 KB Output is correct
26 Correct 4 ms 20824 KB Output is correct
27 Correct 3 ms 20920 KB Output is correct
28 Correct 4 ms 20828 KB Output is correct
29 Correct 3 ms 20828 KB Output is correct
30 Correct 3 ms 20828 KB Output is correct
31 Correct 3 ms 20828 KB Output is correct
32 Correct 4 ms 20956 KB Output is correct
33 Correct 3 ms 20828 KB Output is correct
34 Correct 3 ms 20828 KB Output is correct
35 Correct 4 ms 20940 KB Output is correct
36 Correct 3 ms 20828 KB Output is correct
37 Correct 3 ms 20828 KB Output is correct
38 Correct 3 ms 20828 KB Output is correct
39 Correct 3 ms 20824 KB Output is correct
40 Correct 3 ms 20824 KB Output is correct
41 Correct 3 ms 20828 KB Output is correct
42 Correct 3 ms 20932 KB Output is correct
43 Correct 3 ms 20828 KB Output is correct
44 Correct 3 ms 20824 KB Output is correct
45 Correct 3 ms 20828 KB Output is correct
46 Correct 4 ms 20824 KB Output is correct
47 Correct 4 ms 20828 KB Output is correct
48 Correct 3 ms 20828 KB Output is correct
49 Correct 3 ms 20828 KB Output is correct
50 Correct 4 ms 20828 KB Output is correct
51 Correct 4 ms 20828 KB Output is correct
52 Correct 4 ms 21080 KB Output is correct
53 Correct 4 ms 20828 KB Output is correct
54 Correct 3 ms 20828 KB Output is correct
55 Correct 3 ms 20828 KB Output is correct
56 Correct 4 ms 20828 KB Output is correct
57 Correct 3 ms 20828 KB Output is correct
58 Correct 4 ms 20828 KB Output is correct
59 Correct 4 ms 20828 KB Output is correct
60 Correct 3 ms 20828 KB Output is correct
61 Correct 5 ms 20824 KB Output is correct
62 Correct 5 ms 21080 KB Output is correct
63 Correct 4 ms 21084 KB Output is correct
64 Correct 4 ms 21084 KB Output is correct
65 Correct 5 ms 20828 KB Output is correct
66 Correct 4 ms 21084 KB Output is correct
67 Correct 4 ms 21084 KB Output is correct
68 Correct 4 ms 20828 KB Output is correct
69 Correct 4 ms 20824 KB Output is correct
70 Correct 4 ms 20828 KB Output is correct
71 Correct 4 ms 20828 KB Output is correct
72 Correct 4 ms 21084 KB Output is correct
73 Correct 5 ms 20828 KB Output is correct
74 Correct 4 ms 20828 KB Output is correct
75 Correct 4 ms 20828 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 20828 KB Output is correct
2 Correct 4 ms 20828 KB Output is correct
3 Correct 4 ms 20828 KB Output is correct
4 Correct 4 ms 20828 KB Output is correct
5 Correct 3 ms 20828 KB Output is correct
6 Correct 4 ms 20828 KB Output is correct
7 Correct 3 ms 20828 KB Output is correct
8 Correct 3 ms 20828 KB Output is correct
9 Correct 3 ms 20828 KB Output is correct
10 Correct 3 ms 20828 KB Output is correct
11 Correct 4 ms 21084 KB Output is correct
12 Correct 3 ms 20828 KB Output is correct
13 Correct 3 ms 20824 KB Output is correct
14 Correct 4 ms 20828 KB Output is correct
15 Correct 4 ms 20968 KB Output is correct
16 Correct 4 ms 20828 KB Output is correct
17 Correct 4 ms 20828 KB Output is correct
18 Correct 3 ms 20828 KB Output is correct
19 Correct 3 ms 20828 KB Output is correct
20 Correct 4 ms 21084 KB Output is correct
21 Correct 4 ms 20828 KB Output is correct
22 Correct 4 ms 20828 KB Output is correct
23 Correct 4 ms 20828 KB Output is correct
24 Correct 4 ms 20828 KB Output is correct
25 Correct 3 ms 20824 KB Output is correct
26 Correct 5 ms 20828 KB Output is correct
27 Correct 6 ms 21596 KB Output is correct
28 Correct 5 ms 21508 KB Output is correct
29 Correct 4 ms 21340 KB Output is correct
30 Correct 5 ms 21340 KB Output is correct
31 Correct 5 ms 21596 KB Output is correct
32 Correct 4 ms 21340 KB Output is correct
33 Correct 5 ms 21188 KB Output is correct
34 Correct 4 ms 20824 KB Output is correct
35 Correct 3 ms 20920 KB Output is correct
36 Correct 4 ms 20828 KB Output is correct
37 Correct 3 ms 20828 KB Output is correct
38 Correct 3 ms 20828 KB Output is correct
39 Correct 3 ms 20828 KB Output is correct
40 Correct 4 ms 20956 KB Output is correct
41 Correct 3 ms 20828 KB Output is correct
42 Correct 3 ms 20828 KB Output is correct
43 Correct 4 ms 20940 KB Output is correct
44 Correct 3 ms 20828 KB Output is correct
45 Correct 3 ms 20828 KB Output is correct
46 Correct 3 ms 20828 KB Output is correct
47 Correct 3 ms 20824 KB Output is correct
48 Correct 3 ms 20824 KB Output is correct
49 Correct 3 ms 20828 KB Output is correct
50 Correct 3 ms 20932 KB Output is correct
51 Correct 3 ms 20828 KB Output is correct
52 Correct 3 ms 20824 KB Output is correct
53 Correct 3 ms 20828 KB Output is correct
54 Correct 4 ms 20824 KB Output is correct
55 Correct 4 ms 20828 KB Output is correct
56 Correct 3 ms 20828 KB Output is correct
57 Correct 3 ms 20828 KB Output is correct
58 Correct 4 ms 20828 KB Output is correct
59 Correct 4 ms 20828 KB Output is correct
60 Correct 4 ms 21080 KB Output is correct
61 Correct 4 ms 20828 KB Output is correct
62 Correct 3 ms 20828 KB Output is correct
63 Correct 3 ms 20828 KB Output is correct
64 Correct 4 ms 20828 KB Output is correct
65 Correct 3 ms 20828 KB Output is correct
66 Correct 4 ms 20828 KB Output is correct
67 Correct 4 ms 20828 KB Output is correct
68 Correct 3 ms 20828 KB Output is correct
69 Correct 5 ms 20824 KB Output is correct
70 Correct 5 ms 21080 KB Output is correct
71 Correct 4 ms 21084 KB Output is correct
72 Correct 4 ms 21084 KB Output is correct
73 Correct 5 ms 20828 KB Output is correct
74 Correct 4 ms 21084 KB Output is correct
75 Correct 4 ms 21084 KB Output is correct
76 Correct 4 ms 20828 KB Output is correct
77 Correct 4 ms 20824 KB Output is correct
78 Correct 4 ms 20828 KB Output is correct
79 Correct 4 ms 20828 KB Output is correct
80 Correct 4 ms 21084 KB Output is correct
81 Correct 5 ms 20828 KB Output is correct
82 Correct 4 ms 20828 KB Output is correct
83 Correct 4 ms 20828 KB Output is correct
84 Correct 6 ms 20824 KB Output is correct
85 Correct 6 ms 20828 KB Output is correct
86 Correct 5 ms 21024 KB Output is correct
87 Correct 5 ms 20828 KB Output is correct
88 Correct 5 ms 20828 KB Output is correct
89 Correct 7 ms 21616 KB Output is correct
90 Correct 6 ms 21596 KB Output is correct
91 Correct 7 ms 21596 KB Output is correct
92 Correct 5 ms 21596 KB Output is correct
93 Correct 7 ms 21592 KB Output is correct
94 Correct 5 ms 21336 KB Output is correct
95 Correct 5 ms 21336 KB Output is correct
96 Correct 6 ms 21340 KB Output is correct
97 Correct 6 ms 21596 KB Output is correct
98 Correct 6 ms 21596 KB Output is correct
99 Correct 6 ms 21596 KB Output is correct
100 Correct 6 ms 21340 KB Output is correct
101 Correct 5 ms 21108 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 20828 KB Output is correct
2 Correct 4 ms 20828 KB Output is correct
3 Correct 4 ms 20828 KB Output is correct
4 Correct 4 ms 20828 KB Output is correct
5 Correct 3 ms 20828 KB Output is correct
6 Correct 4 ms 20828 KB Output is correct
7 Correct 3 ms 20828 KB Output is correct
8 Correct 3 ms 20828 KB Output is correct
9 Correct 3 ms 20828 KB Output is correct
10 Correct 3 ms 20828 KB Output is correct
11 Correct 4 ms 21084 KB Output is correct
12 Correct 3 ms 20828 KB Output is correct
13 Correct 3 ms 20824 KB Output is correct
14 Correct 4 ms 20828 KB Output is correct
15 Correct 4 ms 20968 KB Output is correct
16 Correct 4 ms 20828 KB Output is correct
17 Correct 4 ms 20828 KB Output is correct
18 Correct 3 ms 20828 KB Output is correct
19 Correct 3 ms 20828 KB Output is correct
20 Correct 4 ms 21084 KB Output is correct
21 Correct 4 ms 20828 KB Output is correct
22 Correct 4 ms 20828 KB Output is correct
23 Correct 4 ms 20828 KB Output is correct
24 Correct 4 ms 20828 KB Output is correct
25 Correct 3 ms 20824 KB Output is correct
26 Correct 5 ms 20828 KB Output is correct
27 Correct 6 ms 21596 KB Output is correct
28 Correct 5 ms 21508 KB Output is correct
29 Correct 4 ms 21340 KB Output is correct
30 Correct 5 ms 21340 KB Output is correct
31 Correct 5 ms 21596 KB Output is correct
32 Correct 4 ms 21340 KB Output is correct
33 Correct 5 ms 21188 KB Output is correct
34 Correct 4 ms 20824 KB Output is correct
35 Correct 3 ms 20920 KB Output is correct
36 Correct 4 ms 20828 KB Output is correct
37 Correct 3 ms 20828 KB Output is correct
38 Correct 3 ms 20828 KB Output is correct
39 Correct 3 ms 20828 KB Output is correct
40 Correct 4 ms 20956 KB Output is correct
41 Correct 3 ms 20828 KB Output is correct
42 Correct 3 ms 20828 KB Output is correct
43 Correct 4 ms 20940 KB Output is correct
44 Correct 3 ms 20828 KB Output is correct
45 Correct 3 ms 20828 KB Output is correct
46 Correct 3 ms 20828 KB Output is correct
47 Correct 3 ms 20824 KB Output is correct
48 Correct 3 ms 20824 KB Output is correct
49 Correct 3 ms 20828 KB Output is correct
50 Correct 3 ms 20932 KB Output is correct
51 Correct 3 ms 20828 KB Output is correct
52 Correct 3 ms 20824 KB Output is correct
53 Correct 3 ms 20828 KB Output is correct
54 Correct 4 ms 20824 KB Output is correct
55 Correct 4 ms 20828 KB Output is correct
56 Correct 3 ms 20828 KB Output is correct
57 Correct 3 ms 20828 KB Output is correct
58 Correct 4 ms 20828 KB Output is correct
59 Correct 4 ms 20828 KB Output is correct
60 Correct 4 ms 21080 KB Output is correct
61 Correct 4 ms 20828 KB Output is correct
62 Correct 3 ms 20828 KB Output is correct
63 Correct 3 ms 20828 KB Output is correct
64 Correct 4 ms 20828 KB Output is correct
65 Correct 3 ms 20828 KB Output is correct
66 Correct 4 ms 20828 KB Output is correct
67 Correct 4 ms 20828 KB Output is correct
68 Correct 3 ms 20828 KB Output is correct
69 Correct 5 ms 20824 KB Output is correct
70 Correct 5 ms 21080 KB Output is correct
71 Correct 4 ms 21084 KB Output is correct
72 Correct 4 ms 21084 KB Output is correct
73 Correct 5 ms 20828 KB Output is correct
74 Correct 4 ms 21084 KB Output is correct
75 Correct 4 ms 21084 KB Output is correct
76 Correct 4 ms 20828 KB Output is correct
77 Correct 4 ms 20824 KB Output is correct
78 Correct 4 ms 20828 KB Output is correct
79 Correct 4 ms 20828 KB Output is correct
80 Correct 4 ms 21084 KB Output is correct
81 Correct 5 ms 20828 KB Output is correct
82 Correct 4 ms 20828 KB Output is correct
83 Correct 4 ms 20828 KB Output is correct
84 Correct 6 ms 20824 KB Output is correct
85 Correct 6 ms 20828 KB Output is correct
86 Correct 5 ms 21024 KB Output is correct
87 Correct 5 ms 20828 KB Output is correct
88 Correct 5 ms 20828 KB Output is correct
89 Correct 7 ms 21616 KB Output is correct
90 Correct 6 ms 21596 KB Output is correct
91 Correct 7 ms 21596 KB Output is correct
92 Correct 5 ms 21596 KB Output is correct
93 Correct 7 ms 21592 KB Output is correct
94 Correct 5 ms 21336 KB Output is correct
95 Correct 5 ms 21336 KB Output is correct
96 Correct 6 ms 21340 KB Output is correct
97 Correct 6 ms 21596 KB Output is correct
98 Correct 6 ms 21596 KB Output is correct
99 Correct 6 ms 21596 KB Output is correct
100 Correct 6 ms 21340 KB Output is correct
101 Correct 5 ms 21108 KB Output is correct
102 Correct 136 ms 23604 KB Output is correct
103 Correct 148 ms 23632 KB Output is correct
104 Correct 206 ms 64868 KB Output is correct
105 Correct 176 ms 27852 KB Output is correct
106 Correct 160 ms 24852 KB Output is correct
107 Correct 227 ms 73932 KB Output is correct
108 Correct 234 ms 75924 KB Output is correct
109 Correct 88 ms 56120 KB Output is correct
110 Correct 273 ms 74432 KB Output is correct
111 Correct 181 ms 72776 KB Output is correct
112 Correct 249 ms 74172 KB Output is correct
113 Correct 272 ms 72968 KB Output is correct
114 Correct 348 ms 74076 KB Output is correct
115 Correct 79 ms 52152 KB Output is correct
116 Correct 257 ms 75452 KB Output is correct
117 Correct 228 ms 64256 KB Output is correct
118 Correct 346 ms 74048 KB Output is correct
119 Correct 178 ms 33532 KB Output is correct
120 Correct 110 ms 23644 KB Output is correct