Submission #848476

# Submission time Handle Problem Language Result Execution time Memory
848476 2023-09-12T18:11:30 Z oneloveforever Closing Time (IOI23_closing) C++17
83 / 100
780 ms 2097152 KB
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
const long long  inf=1e18+7;
using Graph = vector<vector<pair<int, long long>>> ;
void dfs(int x,int par,Graph &edge,vector<long long>&dist)
{
    for(auto [node,value]:edge[x])
    {
        if(node==par)continue;
        dist[node]=dist[x]+value;
        dfs(node,x,edge,dist);
    }
}
int Sub1(int N,long long K,vector<ll>distX,vector<ll>distY)
{
    vector<ll>que;
    for(int i=1; i<=N; i++)
    {
        que.push_back(distX[i]);
        que.push_back(distY[i]);
    }
    sort(que.begin(),que.end());
    ll res=K;
    int ans=0;
    for(int value:que)
    {
        if(res<value)break;
        res-=value;
        ans++;
    }
    return ans;
}
bool checkLinear(int N,Graph edge,vector<int>&deg)
{
    int maxv=0;
    for(int i=1; i<=N; i++)
    {
        for(auto [x,w]:edge[i])deg[x]++;
        maxv=max(maxv,deg[i]);
    }
    return maxv<=2;
}
void bfs(int N,int need_node,Graph edge,vector<int>&beg)
{
    queue<int>q;
    vector<bool>check(N+1,false);
    q.push(need_node);
    check[need_node]=true;
    int cnt=0;
    while(!q.empty())
    {
        int x=q.front();
        q.pop();
        beg[x]=++cnt;
        for(auto [node,w]:edge[x])
        {
            if(check[node])continue;
            check[node]=true;
            q.push(node);
        }
    }
}
struct node
{
    long long x;
    int bonus,index;
    node(int _x=0,int _index=0,int _bonus=0)
    {
        x=_x,index=_index,bonus=_bonus;
    }
};
bool cmp(node &a,node &b)
{
    return (a.x*(3-a.bonus)<b.x*(3-b.bonus));
}
int Onlyone(int N,long long K,Graph edge,vector<long long>distX,vector<long long>distY)
{
    int ans=0;
    vector<long long>q;
    for(int i=1; i<=N; i++)
    {
        q.push_back(distX[i]);
        q.push_back(distY[i]);
    }
    sort(q.begin(),q.end());
    for(long long value:q)
    {
        if(K>=value)
        {
            K-=value;
            ans++;
        }
    }
    return ans;
}
int Sub2(int N,int X,int Y,long long K,Graph edge,vector<int>deg,vector<long long >distX,vector<long long>distY)
{
    int need_node;
    for(int i=1; i<=N; i++)if(deg[i]==1)need_node=i;
    vector<int>beg(N+1);
    bfs(N,need_node,edge,beg);
    if(beg[X]>beg[Y])swap(X,Y);
    int pre=Onlyone(N,K,edge,distX,distY);
    vector<node>block;
    vector<int>cnt(N+1,0);
    int ans=0;
    vector<int>index(N+1);
    for(int i=1; i<=N; i++)index[beg[i]]=i;
    for(int i=1; i<=N; i++)
    {
        if((beg[i]>=beg[X]&&beg[i]<=beg[Y]))continue;
        long long value_x=min(distX[i],distY[i]);
        long long value_y=max(distX[i],distY[i]);
        if(value_y-value_x>=value_x)
        {
            block.push_back({value_x,i,1});
            block.push_back({value_y-value_x,i,1});
        }
        else block.push_back({value_y,i,2});
    }
    for(int i=beg[X]; i<=beg[Y]; i++)
    {
        int node=index[i];
        long long value_x=min(distX[node],distY[node]);
        long long value_y=max(distX[node],distY[node]);
        K-=value_x;
        ans++;
        cnt[node]=1;
        block.push_back({value_y-value_x,node,1});
    }
    sort(block.begin(),block.end(),cmp);
    if(K>=0)
    {
        for(node &need:block)
        {
            if(K>=need.x)
            {
                K-=need.x;
                cnt[need.index]+=need.bonus;
                ans+=need.bonus;
                need.bonus=0;
            }
        }
        set<pair<long long,int> >s;
        for(node need:block)if(need.bonus==2)s.insert(make_pair(min(distX[need.index],distY[need.index]),need.index));
        for(auto [value,index]:s)
        {
            if(K>=value)
            {
                K-=value;
                ans+=1;
                cnt[index]+=1;
            }
        }
        multiset<long long>pX,pY;
        for(int i=1; i<=N; i++)
        {
            if(cnt[i]==0)pY.insert(max(distX[i],distY[i]));
            if(beg[i]>=beg[X]&&beg[i]<=beg[Y])continue;
            if(cnt[i]==1)pX.insert(min(distX[i],distY[i]));
        }
        while(pX.size()>0&&pY.size()>0)
        {
            auto value_x=prev(pX.end());
            auto value_y=pY.begin();
            long long value=*value_y-*value_x;
            if(K>=value)
            {
                K-=value;
                ans++;
                pX.erase(value_x);
                pY.erase(value_y);
            }
            else break;
        }
        pre=max(ans,pre);
    }
    return pre;
 
}
int Sub3(int N,int X,int Y,long long K,Graph edge,vector<long long>distX,vector<long long>distY)
{
    int pre=Onlyone(N,K,edge,distX,distY);
    vector<bool>check(N+1,false);
    for(int i=1;i<=N;i++)if(distX[i]+distY[i]==distX[Y])check[i]=true;
    vector<int>beg(N+1);
    vector<int>index(N+1);
    bfs(N,X,edge,beg);
    for(int i=1;i<=N;i++)index[beg[i]]=i;
    vector<vector<long long> >dp(N+7,vector<long long>(2*N+7,inf));
    dp[0][0]=0;
    for(int i=1;i<=N;i++)
    {
        for(int cnt=0;cnt<=2*(i-1);cnt++)
        {
            if(check[i])
            {
                dp[i][cnt+1]=min(dp[i][cnt+1],dp[i-1][cnt]+min(distX[i],distY[i]));
                dp[i][cnt+2]=min(dp[i][cnt+2],dp[i-1][cnt]+max(distX[i],distY[i]));
            }
            else
            {
                dp[i][cnt]=min(dp[i][cnt],dp[i-1][cnt]);
                dp[i][cnt+1]=min(dp[i][cnt+1],dp[i-1][cnt]+min(distX[i],distY[i]));
                dp[i][cnt+2]=min(dp[i][cnt+2],dp[i-1][cnt]+max(distX[i],distY[i]));
            }
        }
    }
    int ans=0;
    for(int i=0;i<=2*N;i++)if(dp[N][i]<=K)ans=i;
    return max(pre,ans);
}
int max_score(int N,int X,int Y,long long K,vector<int>U,vector<int>V,vector<int>W)
{
    X+=1;
    Y+=1;
    Graph edge(N+1);
    for(int i=1; i<=N-1; i++)
    {
        int x=U[i-1]+1;
        int y=V[i-1]+1;
        int value=W[i-1];
        edge[x].push_back({y,value});
        edge[y].push_back({x,value});
    }
    vector<long long>distX(N+1);
    vector<long long>distY(N+1);
    dfs(X,0,edge,distX);
    dfs(Y,0,edge,distY);
    if(distX[Y]>2*K)return Sub1(N,K,distX,distY);
    vector<int>deg(N+1);
    //if(checkLinear(N,edge,deg))return Sub2(N,X,Y,K,edge,deg,distX,distY);
    return Sub3(N,X,Y,K,edge,distX,distY);
}
/*signed main()
{
    int n,x,y,k;
    vector<int>U;
    vector<int>V;
    vector<int>W;
    cin>>n>>x>>y>>k;
    for(int i=1; i<=n-1; i++)
    {
        int x;
        cin>>x;
        U.push_back(x);
    }
    for(int i=1; i<=n-1; i++)
    {
        int y;
        cin>>y;
        V.push_back(y);
    }
    for(int i=1; i<=n-1; i++)
    {
        int value;
        cin>>value;
        W.push_back(value);
    }
    cout<<max_score(n,x,y,k,U,V,W);
}*/

Compilation message

closing.cpp: In function 'int Sub2(int, int, int, long long int, Graph, std::vector<int>, std::vector<long long int>, std::vector<long long int>)':
closing.cpp:119:30: warning: narrowing conversion of 'value_x' from 'long long int' to 'int' [-Wnarrowing]
  119 |             block.push_back({value_x,i,1});
      |                              ^~~~~~~
closing.cpp:120:37: warning: narrowing conversion of '(value_y - value_x)' from 'long long int' to 'int' [-Wnarrowing]
  120 |             block.push_back({value_y-value_x,i,1});
      |                              ~~~~~~~^~~~~~~~
closing.cpp:122:31: warning: narrowing conversion of 'value_y' from 'long long int' to 'int' [-Wnarrowing]
  122 |         else block.push_back({value_y,i,2});
      |                               ^~~~~~~
closing.cpp:132:33: warning: narrowing conversion of '(value_y - value_x)' from 'long long int' to 'int' [-Wnarrowing]
  132 |         block.push_back({value_y-value_x,node,1});
      |                          ~~~~~~~^~~~~~~~
closing.cpp:104:8: warning: 'need_node' may be used uninitialized in this function [-Wmaybe-uninitialized]
  104 |     bfs(N,need_node,edge,beg);
      |     ~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 143 ms 36344 KB Output is correct
2 Correct 135 ms 42688 KB Output is correct
3 Correct 75 ms 2896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 1 ms 600 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 1 ms 408 KB Output is correct
19 Correct 3 ms 4440 KB Output is correct
20 Correct 3 ms 3928 KB Output is correct
21 Correct 2 ms 4184 KB Output is correct
22 Correct 3 ms 4440 KB Output is correct
23 Correct 3 ms 4440 KB Output is correct
24 Correct 4 ms 4440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 600 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 1 ms 600 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 1 ms 600 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 1 ms 408 KB Output is correct
19 Correct 3 ms 4440 KB Output is correct
20 Correct 3 ms 3928 KB Output is correct
21 Correct 2 ms 4184 KB Output is correct
22 Correct 3 ms 4440 KB Output is correct
23 Correct 3 ms 4440 KB Output is correct
24 Correct 4 ms 4440 KB Output is correct
25 Correct 2 ms 344 KB Output is correct
26 Correct 86 ms 142692 KB Output is correct
27 Correct 74 ms 123476 KB Output is correct
28 Correct 70 ms 125352 KB Output is correct
29 Correct 75 ms 135348 KB Output is correct
30 Correct 79 ms 122592 KB Output is correct
31 Correct 77 ms 142672 KB Output is correct
32 Correct 78 ms 142672 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 344 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 436 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 1 ms 600 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 1 ms 344 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 1 ms 344 KB Output is correct
29 Correct 1 ms 344 KB Output is correct
30 Correct 0 ms 436 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 0 ms 344 KB Output is correct
37 Correct 1 ms 344 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 1 ms 600 KB Output is correct
40 Correct 1 ms 600 KB Output is correct
41 Correct 1 ms 600 KB Output is correct
42 Correct 1 ms 600 KB Output is correct
43 Correct 1 ms 600 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
45 Correct 1 ms 600 KB Output is correct
46 Correct 1 ms 600 KB Output is correct
47 Correct 1 ms 604 KB Output is correct
48 Correct 0 ms 344 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 1 ms 600 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 1 ms 408 KB Output is correct
20 Correct 3 ms 4440 KB Output is correct
21 Correct 3 ms 3928 KB Output is correct
22 Correct 2 ms 4184 KB Output is correct
23 Correct 3 ms 4440 KB Output is correct
24 Correct 3 ms 4440 KB Output is correct
25 Correct 4 ms 4440 KB Output is correct
26 Correct 1 ms 344 KB Output is correct
27 Correct 0 ms 344 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
29 Correct 0 ms 344 KB Output is correct
30 Correct 1 ms 344 KB Output is correct
31 Correct 0 ms 344 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 0 ms 344 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 1 ms 344 KB Output is correct
37 Correct 0 ms 436 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 0 ms 344 KB Output is correct
40 Correct 0 ms 344 KB Output is correct
41 Correct 1 ms 344 KB Output is correct
42 Correct 1 ms 344 KB Output is correct
43 Correct 0 ms 344 KB Output is correct
44 Correct 1 ms 344 KB Output is correct
45 Correct 1 ms 344 KB Output is correct
46 Correct 1 ms 600 KB Output is correct
47 Correct 1 ms 600 KB Output is correct
48 Correct 1 ms 600 KB Output is correct
49 Correct 1 ms 600 KB Output is correct
50 Correct 1 ms 600 KB Output is correct
51 Correct 1 ms 604 KB Output is correct
52 Correct 1 ms 600 KB Output is correct
53 Correct 1 ms 600 KB Output is correct
54 Correct 1 ms 604 KB Output is correct
55 Correct 0 ms 344 KB Output is correct
56 Correct 1 ms 344 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 1 ms 600 KB Output is correct
60 Correct 1 ms 600 KB Output is correct
61 Correct 1 ms 860 KB Output is correct
62 Correct 1 ms 860 KB Output is correct
63 Correct 3 ms 4440 KB Output is correct
64 Correct 3 ms 3928 KB Output is correct
65 Correct 3 ms 3672 KB Output is correct
66 Correct 3 ms 3928 KB Output is correct
67 Correct 3 ms 4444 KB Output is correct
68 Correct 3 ms 3672 KB Output is correct
69 Correct 3 ms 4440 KB Output is correct
70 Correct 4 ms 4184 KB Output is correct
71 Correct 3 ms 4184 KB Output is correct
72 Correct 3 ms 4184 KB Output is correct
73 Correct 2 ms 2904 KB Output is correct
74 Correct 3 ms 3160 KB Output is correct
75 Correct 1 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 1 ms 600 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 1 ms 408 KB Output is correct
20 Correct 3 ms 4440 KB Output is correct
21 Correct 3 ms 3928 KB Output is correct
22 Correct 2 ms 4184 KB Output is correct
23 Correct 3 ms 4440 KB Output is correct
24 Correct 3 ms 4440 KB Output is correct
25 Correct 4 ms 4440 KB Output is correct
26 Correct 2 ms 344 KB Output is correct
27 Correct 86 ms 142692 KB Output is correct
28 Correct 74 ms 123476 KB Output is correct
29 Correct 70 ms 125352 KB Output is correct
30 Correct 75 ms 135348 KB Output is correct
31 Correct 79 ms 122592 KB Output is correct
32 Correct 77 ms 142672 KB Output is correct
33 Correct 78 ms 142672 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 0 ms 344 KB Output is correct
36 Correct 0 ms 344 KB Output is correct
37 Correct 0 ms 344 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 0 ms 344 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 344 KB Output is correct
42 Correct 0 ms 344 KB Output is correct
43 Correct 1 ms 344 KB Output is correct
44 Correct 1 ms 344 KB Output is correct
45 Correct 0 ms 436 KB Output is correct
46 Correct 1 ms 344 KB Output is correct
47 Correct 0 ms 344 KB Output is correct
48 Correct 0 ms 344 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 0 ms 344 KB Output is correct
52 Correct 1 ms 344 KB Output is correct
53 Correct 1 ms 344 KB Output is correct
54 Correct 1 ms 600 KB Output is correct
55 Correct 1 ms 600 KB Output is correct
56 Correct 1 ms 600 KB Output is correct
57 Correct 1 ms 600 KB Output is correct
58 Correct 1 ms 600 KB Output is correct
59 Correct 1 ms 604 KB Output is correct
60 Correct 1 ms 600 KB Output is correct
61 Correct 1 ms 600 KB Output is correct
62 Correct 1 ms 604 KB Output is correct
63 Correct 0 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 1 ms 600 KB Output is correct
68 Correct 1 ms 600 KB Output is correct
69 Correct 1 ms 860 KB Output is correct
70 Correct 1 ms 860 KB Output is correct
71 Correct 3 ms 4440 KB Output is correct
72 Correct 3 ms 3928 KB Output is correct
73 Correct 3 ms 3672 KB Output is correct
74 Correct 3 ms 3928 KB Output is correct
75 Correct 3 ms 4444 KB Output is correct
76 Correct 3 ms 3672 KB Output is correct
77 Correct 3 ms 4440 KB Output is correct
78 Correct 4 ms 4184 KB Output is correct
79 Correct 3 ms 4184 KB Output is correct
80 Correct 3 ms 4184 KB Output is correct
81 Correct 2 ms 2904 KB Output is correct
82 Correct 3 ms 3160 KB Output is correct
83 Correct 1 ms 600 KB Output is correct
84 Correct 3 ms 600 KB Output is correct
85 Correct 9 ms 1804 KB Output is correct
86 Correct 3 ms 712 KB Output is correct
87 Correct 5 ms 920 KB Output is correct
88 Correct 6 ms 924 KB Output is correct
89 Correct 93 ms 142672 KB Output is correct
90 Correct 69 ms 117072 KB Output is correct
91 Correct 82 ms 141388 KB Output is correct
92 Correct 73 ms 122960 KB Output is correct
93 Correct 74 ms 125644 KB Output is correct
94 Correct 73 ms 129360 KB Output is correct
95 Correct 76 ms 135760 KB Output is correct
96 Correct 69 ms 118864 KB Output is correct
97 Correct 83 ms 135204 KB Output is correct
98 Correct 80 ms 131440 KB Output is correct
99 Correct 85 ms 142572 KB Output is correct
100 Correct 46 ms 69212 KB Output is correct
101 Correct 10 ms 4516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 600 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 600 KB Output is correct
15 Correct 1 ms 600 KB Output is correct
16 Correct 1 ms 600 KB Output is correct
17 Correct 1 ms 600 KB Output is correct
18 Correct 1 ms 600 KB Output is correct
19 Correct 1 ms 408 KB Output is correct
20 Correct 3 ms 4440 KB Output is correct
21 Correct 3 ms 3928 KB Output is correct
22 Correct 2 ms 4184 KB Output is correct
23 Correct 3 ms 4440 KB Output is correct
24 Correct 3 ms 4440 KB Output is correct
25 Correct 4 ms 4440 KB Output is correct
26 Correct 2 ms 344 KB Output is correct
27 Correct 86 ms 142692 KB Output is correct
28 Correct 74 ms 123476 KB Output is correct
29 Correct 70 ms 125352 KB Output is correct
30 Correct 75 ms 135348 KB Output is correct
31 Correct 79 ms 122592 KB Output is correct
32 Correct 77 ms 142672 KB Output is correct
33 Correct 78 ms 142672 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 0 ms 344 KB Output is correct
36 Correct 0 ms 344 KB Output is correct
37 Correct 0 ms 344 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 0 ms 344 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 ms 344 KB Output is correct
42 Correct 0 ms 344 KB Output is correct
43 Correct 1 ms 344 KB Output is correct
44 Correct 1 ms 344 KB Output is correct
45 Correct 0 ms 436 KB Output is correct
46 Correct 1 ms 344 KB Output is correct
47 Correct 0 ms 344 KB Output is correct
48 Correct 0 ms 344 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 1 ms 344 KB Output is correct
51 Correct 0 ms 344 KB Output is correct
52 Correct 1 ms 344 KB Output is correct
53 Correct 1 ms 344 KB Output is correct
54 Correct 1 ms 600 KB Output is correct
55 Correct 1 ms 600 KB Output is correct
56 Correct 1 ms 600 KB Output is correct
57 Correct 1 ms 600 KB Output is correct
58 Correct 1 ms 600 KB Output is correct
59 Correct 1 ms 604 KB Output is correct
60 Correct 1 ms 600 KB Output is correct
61 Correct 1 ms 600 KB Output is correct
62 Correct 1 ms 604 KB Output is correct
63 Correct 0 ms 344 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 1 ms 600 KB Output is correct
68 Correct 1 ms 600 KB Output is correct
69 Correct 1 ms 860 KB Output is correct
70 Correct 1 ms 860 KB Output is correct
71 Correct 3 ms 4440 KB Output is correct
72 Correct 3 ms 3928 KB Output is correct
73 Correct 3 ms 3672 KB Output is correct
74 Correct 3 ms 3928 KB Output is correct
75 Correct 3 ms 4444 KB Output is correct
76 Correct 3 ms 3672 KB Output is correct
77 Correct 3 ms 4440 KB Output is correct
78 Correct 4 ms 4184 KB Output is correct
79 Correct 3 ms 4184 KB Output is correct
80 Correct 3 ms 4184 KB Output is correct
81 Correct 2 ms 2904 KB Output is correct
82 Correct 3 ms 3160 KB Output is correct
83 Correct 1 ms 600 KB Output is correct
84 Correct 3 ms 600 KB Output is correct
85 Correct 9 ms 1804 KB Output is correct
86 Correct 3 ms 712 KB Output is correct
87 Correct 5 ms 920 KB Output is correct
88 Correct 6 ms 924 KB Output is correct
89 Correct 93 ms 142672 KB Output is correct
90 Correct 69 ms 117072 KB Output is correct
91 Correct 82 ms 141388 KB Output is correct
92 Correct 73 ms 122960 KB Output is correct
93 Correct 74 ms 125644 KB Output is correct
94 Correct 73 ms 129360 KB Output is correct
95 Correct 76 ms 135760 KB Output is correct
96 Correct 69 ms 118864 KB Output is correct
97 Correct 83 ms 135204 KB Output is correct
98 Correct 80 ms 131440 KB Output is correct
99 Correct 85 ms 142572 KB Output is correct
100 Correct 46 ms 69212 KB Output is correct
101 Correct 10 ms 4516 KB Output is correct
102 Correct 205 ms 5756 KB Output is correct
103 Correct 629 ms 8356 KB Output is correct
104 Runtime error 780 ms 2097152 KB Execution killed with signal 9
105 Halted 0 ms 0 KB -