Submission #1094591

# Submission time Handle Problem Language Result Execution time Memory
1094591 2024-09-30T04:15:18 Z azberjibiou Closing Time (IOI23_closing) C++17
100 / 100
758 ms 73176 KB
#include "closing.h"

#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define pb push_back
#define lb lower_bound
#define gibon ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define pii pair<int, int>
#define pll pair<ll, ll>
typedef long long ll;
using namespace std;
const int mxN=200010;
const int mxM=200100;
const int mxK=61;
const int MOD=1e9;
const ll INF=2e18;
int N, X, Y;
ll K;
vector <pll> v[mxN];
ll d[mxN], D[mxN];
struct cmpd{
    bool operator()(const int a, const int b) const {
        if(d[a]!=d[b]) return d[a]<d[b];
        return a<b;
    }
};
struct cmpD{
    bool operator()(const int a, const int b) const {
        if(D[a]!=D[b]) return D[a]<D[b];
        return a<b;
    }
};
struct cmpDd{
    bool operator()(const int a, const int b) const {
        if(D[a]-d[a]!=D[b]-d[b]) return D[a]-d[a]<D[b]-d[b];
        return a<b;
    }
};
set <int, cmpd> s0d, s1d;
set <int, cmpD> s0D;
set <int, cmpDd> s1Dd, s2Dd;

void input(){
    cin >> N >> X >> Y >> K;
    X++, Y++;
    for(int i=1;i<N;i++){
        int a, b, c;
        cin >> a >> b >> c;
        a++; b++;
        v[a].emplace_back(b, c);
        v[b].emplace_back(a, c);
    }
}
int par[mxN][20];
ll dep[mxN], depp[mxN];//dep: 거리, depp: 간선 개수
void init(){
    for(int i=1;i<=N;i++) v[i].clear();
    for(int i=1;i<=N;i++) d[i]=D[i]=0;
    for(int i=1;i<=N;i++) for(int j=0;j<20;j++) par[i][j]=0;
    for(int i=1;i<=N;i++) dep[i]=depp[i]=0;
    s0d.clear(), s1d.clear(), s0D.clear(), s1Dd.clear(), s2Dd.clear();
}
void dfs(int now, int pre){
    for(auto [nxt, x] : v[now]) if(nxt!=pre){
        dep[nxt]=dep[now]+x;
        depp[nxt]=depp[now]+1;
        par[nxt][0]=now;
        dfs(nxt, now);
    }
}
void make_sps(){
    for(int i=1;i<20;i++) for(int j=1;j<=N;j++){
        par[j][i]=par[par[j][i-1]][i-1];
    }
}
int lca(int a, int b){
    if(depp[a]<depp[b]) swap(a, b);
    for(int i=19;i>=0;i--) if(depp[a]>=depp[b]+(1<<i)) a=par[a][i];
    if(a==b) return a;
    for(int i=19;i>=0;i--) if(par[a][i]!=par[b][i]) a=par[a][i], b=par[b][i];
    return par[a][0];
}
ll dist(int a, int b){
    int c=lca(a, b);
    return dep[a]+dep[b]-2*dep[c];
}
ll solv1(){
    vector <ll> ct;
    for(int i=1;i<=N;i++) ct.push_back(d[i]);
    sort(all(ct));
    ll sum=0, cnt=0;
    for(ll x : ct) if(sum+x<=K) sum+=x, cnt++;
    return cnt;
}
ll f01(bool del){
    if(s0d.empty()) return INF;
    int now=*s0d.begin();
    if(!del) return d[now];
    s0d.erase(now), s0D.erase(now);
    s1d.insert(now), s1Dd.insert(now);
    return 0;
}
ll f12(bool del){
    if(s1Dd.empty()) return INF;
    int now=*s1Dd.begin();
    if(!del) return D[now]-d[now];
    s1d.erase(now), s1Dd.erase(now);
    s2Dd.insert(now);
    return 0;
}
ll f1002(bool del){
    if(s1d.empty() || s0D.empty()) return INF;
    int n1=*s1d.rbegin(), n2=*s0D.begin();
    if(!del) return D[n2]-d[n1];
    s1d.erase(n1), s1Dd.erase(n1);
    s0d.insert(n1), s0D.insert(n1);
    s0d.erase(n2), s0D.erase(n2);
    s2Dd.insert(n2);
    return 0;
}
ll f2102(bool del){
    if(s2Dd.empty() || s0D.empty()) return INF;
    int n1=*s2Dd.rbegin(), n2=*s0D.begin();
    if(!del) return D[n2]-(D[n1]-d[n1]);
    s2Dd.erase(n1);
    s1d.insert(n1), s1Dd.insert(n1);
    s0d.erase(n2), s0D.erase(n2);
    s2Dd.insert(n2);
    return 0;
}
ll solv2(){
    ll sum=0, cnt=0;
    ll dXY=dist(X, Y);
    for(int i=1;i<=N;i++){
        if(d[i]+D[i]==dXY){
            sum+=d[i];
            D[i]-=d[i];
            d[i]=0;
        }
    }
    //for(int i=1;i<=N;i++) printf("d[%d]=%lld, D[%d]=%lld\n", i, d[i], i, D[i]);
    if(sum>K) return 0;
    //printf("sum=%lld\n", sum);
    for(int i=1;i<=N;i++) s0d.insert(i), s0D.insert(i);
    while(true){
        if(s0d.empty() && s1d.empty()) break;
        /*printf("s0d\n");
        for(int x : s0d) printf("%d ", x);
        printf("\ns1d\n");
        for(int x : s1Dd) printf("%d ", x);
        printf("\ns2d\n");
        for(int x : s2Dd) printf("%d ", x);
        printf("\n");
        */
        ll val1=f01(false), val2=f12(false), val3=f1002(false), val4=f2102(false);
        ll val=min(min(min(val1, val2), val3), val4);
        //printf("val=%lld\n", val);
        if(sum+val>K) break;
        sum+=val, cnt++;
        if(val==val1) f01(true);
        else if(val==val2) f12(true);
        else if(val==val3) f1002(true);
        else f2102(true);
    }
    return cnt;
}
int solve(){
    dfs(1, -1);
    //for(int i=1;i<=N;i++) printf("par[%d]=%d\n", i, par[i][0]);
    make_sps();
    for(int i=1;i<=N;i++) d[i]=dist(X, i), D[i]=dist(Y, i);
    for(int i=1;i<=N;i++) if(d[i]>D[i]) swap(d[i], D[i]);
    ll res1=solv1(), res2=solv2();
    //printf("res1=%lld, res2=%lld\n", res1, res2);
    return max(res1, res2);
}

int max_score(int n, int x, int y, long long k,
        std::vector<int> U, std::vector<int> V, std::vector<int> W)
{
    N=n, X=x, Y=y, K=k;
    X++, Y++;
    for(int i=0;i<N-1;i++){
        v[U[i]+1].emplace_back(V[i]+1, W[i]);
        v[V[i]+1].emplace_back(U[i]+1, W[i]);
    }
    ll ans=solve();
    init();
    return ans;
}
/*
int main()
{
    gibon
    input();
    cout << solve();
}
*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 235 ms 50616 KB Output is correct
2 Correct 245 ms 54724 KB Output is correct
3 Correct 81 ms 10268 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4956 KB Output is correct
2 Correct 2 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 2 ms 4992 KB Output is correct
9 Correct 2 ms 4956 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4956 KB Output is correct
2 Correct 2 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 2 ms 4992 KB Output is correct
9 Correct 2 ms 4956 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4956 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 2 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
19 Correct 2 ms 5212 KB Output is correct
20 Correct 2 ms 5212 KB Output is correct
21 Correct 3 ms 5208 KB Output is correct
22 Correct 3 ms 5212 KB Output is correct
23 Correct 2 ms 5208 KB Output is correct
24 Correct 2 ms 5212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 4956 KB Output is correct
2 Correct 2 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 2 ms 4992 KB Output is correct
9 Correct 2 ms 4956 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4956 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 2 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
19 Correct 2 ms 5212 KB Output is correct
20 Correct 2 ms 5212 KB Output is correct
21 Correct 3 ms 5208 KB Output is correct
22 Correct 3 ms 5212 KB Output is correct
23 Correct 2 ms 5208 KB Output is correct
24 Correct 2 ms 5212 KB Output is correct
25 Correct 4 ms 5212 KB Output is correct
26 Correct 5 ms 6216 KB Output is correct
27 Correct 4 ms 5932 KB Output is correct
28 Correct 5 ms 5980 KB Output is correct
29 Correct 6 ms 5980 KB Output is correct
30 Correct 3 ms 5720 KB Output is correct
31 Correct 4 ms 5980 KB Output is correct
32 Correct 4 ms 5976 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Correct 3 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 3 ms 5116 KB Output is correct
8 Correct 2 ms 4956 KB Output is correct
9 Correct 2 ms 5148 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4952 KB Output is correct
14 Correct 2 ms 4956 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 2 ms 4956 KB Output is correct
18 Correct 2 ms 4968 KB Output is correct
19 Correct 2 ms 4964 KB Output is correct
20 Correct 2 ms 4968 KB Output is correct
21 Correct 2 ms 4964 KB Output is correct
22 Correct 2 ms 4968 KB Output is correct
23 Correct 3 ms 4968 KB Output is correct
24 Correct 2 ms 5024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Correct 3 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 2 ms 4956 KB Output is correct
9 Correct 2 ms 4992 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4956 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 2 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
19 Correct 3 ms 5116 KB Output is correct
20 Correct 2 ms 4956 KB Output is correct
21 Correct 2 ms 5148 KB Output is correct
22 Correct 2 ms 4956 KB Output is correct
23 Correct 2 ms 4956 KB Output is correct
24 Correct 2 ms 4956 KB Output is correct
25 Correct 2 ms 4952 KB Output is correct
26 Correct 2 ms 4956 KB Output is correct
27 Correct 2 ms 4956 KB Output is correct
28 Correct 2 ms 4956 KB Output is correct
29 Correct 2 ms 4956 KB Output is correct
30 Correct 2 ms 4968 KB Output is correct
31 Correct 2 ms 4964 KB Output is correct
32 Correct 2 ms 4968 KB Output is correct
33 Correct 2 ms 4964 KB Output is correct
34 Correct 2 ms 4968 KB Output is correct
35 Correct 3 ms 4968 KB Output is correct
36 Correct 2 ms 5024 KB Output is correct
37 Correct 2 ms 5220 KB Output is correct
38 Correct 3 ms 4968 KB Output is correct
39 Correct 2 ms 4980 KB Output is correct
40 Correct 2 ms 4968 KB Output is correct
41 Correct 2 ms 4968 KB Output is correct
42 Correct 2 ms 4968 KB Output is correct
43 Correct 4 ms 4968 KB Output is correct
44 Correct 2 ms 5060 KB Output is correct
45 Correct 2 ms 4968 KB Output is correct
46 Correct 2 ms 5208 KB Output is correct
47 Correct 2 ms 4968 KB Output is correct
48 Correct 2 ms 4968 KB Output is correct
49 Correct 3 ms 5156 KB Output is correct
50 Correct 2 ms 5044 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Correct 3 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 2 ms 4956 KB Output is correct
9 Correct 2 ms 4992 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4956 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 2 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
19 Correct 2 ms 4956 KB Output is correct
20 Correct 2 ms 5212 KB Output is correct
21 Correct 2 ms 5212 KB Output is correct
22 Correct 3 ms 5208 KB Output is correct
23 Correct 3 ms 5212 KB Output is correct
24 Correct 2 ms 5208 KB Output is correct
25 Correct 2 ms 5212 KB Output is correct
26 Correct 3 ms 5116 KB Output is correct
27 Correct 2 ms 4956 KB Output is correct
28 Correct 2 ms 5148 KB Output is correct
29 Correct 2 ms 4956 KB Output is correct
30 Correct 2 ms 4956 KB Output is correct
31 Correct 2 ms 4956 KB Output is correct
32 Correct 2 ms 4952 KB Output is correct
33 Correct 2 ms 4956 KB Output is correct
34 Correct 2 ms 4956 KB Output is correct
35 Correct 2 ms 4956 KB Output is correct
36 Correct 2 ms 4956 KB Output is correct
37 Correct 2 ms 4968 KB Output is correct
38 Correct 2 ms 4964 KB Output is correct
39 Correct 2 ms 4968 KB Output is correct
40 Correct 2 ms 4964 KB Output is correct
41 Correct 2 ms 4968 KB Output is correct
42 Correct 3 ms 4968 KB Output is correct
43 Correct 2 ms 5024 KB Output is correct
44 Correct 2 ms 5220 KB Output is correct
45 Correct 3 ms 4968 KB Output is correct
46 Correct 2 ms 4980 KB Output is correct
47 Correct 2 ms 4968 KB Output is correct
48 Correct 2 ms 4968 KB Output is correct
49 Correct 2 ms 4968 KB Output is correct
50 Correct 4 ms 4968 KB Output is correct
51 Correct 2 ms 5060 KB Output is correct
52 Correct 2 ms 4968 KB Output is correct
53 Correct 2 ms 5208 KB Output is correct
54 Correct 2 ms 4968 KB Output is correct
55 Correct 2 ms 4968 KB Output is correct
56 Correct 3 ms 5156 KB Output is correct
57 Correct 2 ms 5044 KB Output is correct
58 Correct 4 ms 4968 KB Output is correct
59 Correct 3 ms 5224 KB Output is correct
60 Correct 3 ms 4968 KB Output is correct
61 Correct 3 ms 5224 KB Output is correct
62 Correct 2 ms 5224 KB Output is correct
63 Correct 3 ms 5224 KB Output is correct
64 Correct 3 ms 5220 KB Output is correct
65 Correct 3 ms 5160 KB Output is correct
66 Correct 2 ms 5224 KB Output is correct
67 Correct 2 ms 5224 KB Output is correct
68 Correct 3 ms 5224 KB Output is correct
69 Correct 3 ms 5224 KB Output is correct
70 Correct 2 ms 5168 KB Output is correct
71 Correct 2 ms 5224 KB Output is correct
72 Correct 4 ms 5220 KB Output is correct
73 Correct 3 ms 5224 KB Output is correct
74 Correct 3 ms 5160 KB Output is correct
75 Correct 3 ms 5224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Correct 3 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 2 ms 4956 KB Output is correct
9 Correct 2 ms 4992 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4956 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 2 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
19 Correct 2 ms 4956 KB Output is correct
20 Correct 2 ms 5212 KB Output is correct
21 Correct 2 ms 5212 KB Output is correct
22 Correct 3 ms 5208 KB Output is correct
23 Correct 3 ms 5212 KB Output is correct
24 Correct 2 ms 5208 KB Output is correct
25 Correct 2 ms 5212 KB Output is correct
26 Correct 4 ms 5212 KB Output is correct
27 Correct 5 ms 6216 KB Output is correct
28 Correct 4 ms 5932 KB Output is correct
29 Correct 5 ms 5980 KB Output is correct
30 Correct 6 ms 5980 KB Output is correct
31 Correct 3 ms 5720 KB Output is correct
32 Correct 4 ms 5980 KB Output is correct
33 Correct 4 ms 5976 KB Output is correct
34 Correct 3 ms 5116 KB Output is correct
35 Correct 2 ms 4956 KB Output is correct
36 Correct 2 ms 5148 KB Output is correct
37 Correct 2 ms 4956 KB Output is correct
38 Correct 2 ms 4956 KB Output is correct
39 Correct 2 ms 4956 KB Output is correct
40 Correct 2 ms 4952 KB Output is correct
41 Correct 2 ms 4956 KB Output is correct
42 Correct 2 ms 4956 KB Output is correct
43 Correct 2 ms 4956 KB Output is correct
44 Correct 2 ms 4956 KB Output is correct
45 Correct 2 ms 4968 KB Output is correct
46 Correct 2 ms 4964 KB Output is correct
47 Correct 2 ms 4968 KB Output is correct
48 Correct 2 ms 4964 KB Output is correct
49 Correct 2 ms 4968 KB Output is correct
50 Correct 3 ms 4968 KB Output is correct
51 Correct 2 ms 5024 KB Output is correct
52 Correct 2 ms 5220 KB Output is correct
53 Correct 3 ms 4968 KB Output is correct
54 Correct 2 ms 4980 KB Output is correct
55 Correct 2 ms 4968 KB Output is correct
56 Correct 2 ms 4968 KB Output is correct
57 Correct 2 ms 4968 KB Output is correct
58 Correct 4 ms 4968 KB Output is correct
59 Correct 2 ms 5060 KB Output is correct
60 Correct 2 ms 4968 KB Output is correct
61 Correct 2 ms 5208 KB Output is correct
62 Correct 2 ms 4968 KB Output is correct
63 Correct 2 ms 4968 KB Output is correct
64 Correct 3 ms 5156 KB Output is correct
65 Correct 2 ms 5044 KB Output is correct
66 Correct 4 ms 4968 KB Output is correct
67 Correct 3 ms 5224 KB Output is correct
68 Correct 3 ms 4968 KB Output is correct
69 Correct 3 ms 5224 KB Output is correct
70 Correct 2 ms 5224 KB Output is correct
71 Correct 3 ms 5224 KB Output is correct
72 Correct 3 ms 5220 KB Output is correct
73 Correct 3 ms 5160 KB Output is correct
74 Correct 2 ms 5224 KB Output is correct
75 Correct 2 ms 5224 KB Output is correct
76 Correct 3 ms 5224 KB Output is correct
77 Correct 3 ms 5224 KB Output is correct
78 Correct 2 ms 5168 KB Output is correct
79 Correct 2 ms 5224 KB Output is correct
80 Correct 4 ms 5220 KB Output is correct
81 Correct 3 ms 5224 KB Output is correct
82 Correct 3 ms 5160 KB Output is correct
83 Correct 3 ms 5224 KB Output is correct
84 Correct 4 ms 5224 KB Output is correct
85 Correct 4 ms 5224 KB Output is correct
86 Correct 4 ms 5224 KB Output is correct
87 Correct 4 ms 5224 KB Output is correct
88 Correct 5 ms 5232 KB Output is correct
89 Correct 6 ms 5992 KB Output is correct
90 Correct 6 ms 5736 KB Output is correct
91 Correct 5 ms 5992 KB Output is correct
92 Correct 6 ms 5992 KB Output is correct
93 Correct 4 ms 5736 KB Output is correct
94 Correct 5 ms 5992 KB Output is correct
95 Correct 5 ms 5976 KB Output is correct
96 Correct 4 ms 5724 KB Output is correct
97 Correct 7 ms 5980 KB Output is correct
98 Correct 6 ms 5924 KB Output is correct
99 Correct 6 ms 5980 KB Output is correct
100 Correct 6 ms 5724 KB Output is correct
101 Correct 6 ms 5208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4956 KB Output is correct
2 Correct 3 ms 4956 KB Output is correct
3 Correct 2 ms 4956 KB Output is correct
4 Correct 2 ms 4956 KB Output is correct
5 Correct 2 ms 4956 KB Output is correct
6 Correct 2 ms 4956 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
8 Correct 2 ms 4956 KB Output is correct
9 Correct 2 ms 4992 KB Output is correct
10 Correct 2 ms 4956 KB Output is correct
11 Correct 2 ms 4956 KB Output is correct
12 Correct 2 ms 4956 KB Output is correct
13 Correct 2 ms 4956 KB Output is correct
14 Correct 2 ms 4956 KB Output is correct
15 Correct 2 ms 4956 KB Output is correct
16 Correct 2 ms 4956 KB Output is correct
17 Correct 2 ms 4956 KB Output is correct
18 Correct 2 ms 4956 KB Output is correct
19 Correct 2 ms 4956 KB Output is correct
20 Correct 2 ms 5212 KB Output is correct
21 Correct 2 ms 5212 KB Output is correct
22 Correct 3 ms 5208 KB Output is correct
23 Correct 3 ms 5212 KB Output is correct
24 Correct 2 ms 5208 KB Output is correct
25 Correct 2 ms 5212 KB Output is correct
26 Correct 4 ms 5212 KB Output is correct
27 Correct 5 ms 6216 KB Output is correct
28 Correct 4 ms 5932 KB Output is correct
29 Correct 5 ms 5980 KB Output is correct
30 Correct 6 ms 5980 KB Output is correct
31 Correct 3 ms 5720 KB Output is correct
32 Correct 4 ms 5980 KB Output is correct
33 Correct 4 ms 5976 KB Output is correct
34 Correct 3 ms 5116 KB Output is correct
35 Correct 2 ms 4956 KB Output is correct
36 Correct 2 ms 5148 KB Output is correct
37 Correct 2 ms 4956 KB Output is correct
38 Correct 2 ms 4956 KB Output is correct
39 Correct 2 ms 4956 KB Output is correct
40 Correct 2 ms 4952 KB Output is correct
41 Correct 2 ms 4956 KB Output is correct
42 Correct 2 ms 4956 KB Output is correct
43 Correct 2 ms 4956 KB Output is correct
44 Correct 2 ms 4956 KB Output is correct
45 Correct 2 ms 4968 KB Output is correct
46 Correct 2 ms 4964 KB Output is correct
47 Correct 2 ms 4968 KB Output is correct
48 Correct 2 ms 4964 KB Output is correct
49 Correct 2 ms 4968 KB Output is correct
50 Correct 3 ms 4968 KB Output is correct
51 Correct 2 ms 5024 KB Output is correct
52 Correct 2 ms 5220 KB Output is correct
53 Correct 3 ms 4968 KB Output is correct
54 Correct 2 ms 4980 KB Output is correct
55 Correct 2 ms 4968 KB Output is correct
56 Correct 2 ms 4968 KB Output is correct
57 Correct 2 ms 4968 KB Output is correct
58 Correct 4 ms 4968 KB Output is correct
59 Correct 2 ms 5060 KB Output is correct
60 Correct 2 ms 4968 KB Output is correct
61 Correct 2 ms 5208 KB Output is correct
62 Correct 2 ms 4968 KB Output is correct
63 Correct 2 ms 4968 KB Output is correct
64 Correct 3 ms 5156 KB Output is correct
65 Correct 2 ms 5044 KB Output is correct
66 Correct 4 ms 4968 KB Output is correct
67 Correct 3 ms 5224 KB Output is correct
68 Correct 3 ms 4968 KB Output is correct
69 Correct 3 ms 5224 KB Output is correct
70 Correct 2 ms 5224 KB Output is correct
71 Correct 3 ms 5224 KB Output is correct
72 Correct 3 ms 5220 KB Output is correct
73 Correct 3 ms 5160 KB Output is correct
74 Correct 2 ms 5224 KB Output is correct
75 Correct 2 ms 5224 KB Output is correct
76 Correct 3 ms 5224 KB Output is correct
77 Correct 3 ms 5224 KB Output is correct
78 Correct 2 ms 5168 KB Output is correct
79 Correct 2 ms 5224 KB Output is correct
80 Correct 4 ms 5220 KB Output is correct
81 Correct 3 ms 5224 KB Output is correct
82 Correct 3 ms 5160 KB Output is correct
83 Correct 3 ms 5224 KB Output is correct
84 Correct 4 ms 5224 KB Output is correct
85 Correct 4 ms 5224 KB Output is correct
86 Correct 4 ms 5224 KB Output is correct
87 Correct 4 ms 5224 KB Output is correct
88 Correct 5 ms 5232 KB Output is correct
89 Correct 6 ms 5992 KB Output is correct
90 Correct 6 ms 5736 KB Output is correct
91 Correct 5 ms 5992 KB Output is correct
92 Correct 6 ms 5992 KB Output is correct
93 Correct 4 ms 5736 KB Output is correct
94 Correct 5 ms 5992 KB Output is correct
95 Correct 5 ms 5976 KB Output is correct
96 Correct 4 ms 5724 KB Output is correct
97 Correct 7 ms 5980 KB Output is correct
98 Correct 6 ms 5924 KB Output is correct
99 Correct 6 ms 5980 KB Output is correct
100 Correct 6 ms 5724 KB Output is correct
101 Correct 6 ms 5208 KB Output is correct
102 Correct 166 ms 10064 KB Output is correct
103 Correct 194 ms 10260 KB Output is correct
104 Correct 758 ms 68536 KB Output is correct
105 Correct 198 ms 13256 KB Output is correct
106 Correct 228 ms 12272 KB Output is correct
107 Correct 304 ms 57444 KB Output is correct
108 Correct 313 ms 59000 KB Output is correct
109 Correct 110 ms 56004 KB Output is correct
110 Correct 444 ms 64928 KB Output is correct
111 Correct 287 ms 72692 KB Output is correct
112 Correct 374 ms 63932 KB Output is correct
113 Correct 182 ms 46276 KB Output is correct
114 Correct 384 ms 63432 KB Output is correct
115 Correct 430 ms 73176 KB Output is correct
116 Correct 440 ms 65252 KB Output is correct
117 Correct 243 ms 48844 KB Output is correct
118 Correct 439 ms 64416 KB Output is correct
119 Correct 240 ms 18240 KB Output is correct
120 Correct 146 ms 10068 KB Output is correct