Submission #734356

# Submission time Handle Problem Language Result Execution time Memory
734356 2023-05-02T10:09:47 Z bin9638 Road Closures (APIO21_roads) C++17
53 / 100
2000 ms 35700 KB
#include <bits/stdc++.h>

#ifndef SKY
#include "roads.h"
#endif // SKY

using namespace std;

#define N 100010
#define ll long long
#define fs first
#define sc second
#define ii pair<ll,int>
#define pb push_back

#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("omit-frame-pointer")
#pragma GCC optimize("unroll-loops")

const ll MAX_VAL=2e14;

int cnt,k,n,ktr[N],spec[N];
vector<ii>g[N],edge[N];
ll tong,them,cost[N],dp[N][2];
vector<ll>sum[N];
vector<int>lis,ds[N];

struct nho
{
    void build(int u,int p)
    {
        for(auto v:g[u])
            if(v.sc!=p)
            {
                build(v.sc,u);
                cost[v.sc]=v.fs;
            }
    }

    ll solve(int u,int p,int sl,const vector<ll>&s)
    {

        if(sl<0)
            return MAX_VAL;
        ll res=0;
        for(auto v:g[u])
            if(v.sc!=p)
                if(dp[v.sc][0]<=dp[v.sc][1])
                {
                    res+=dp[v.sc][0];
                }else
                {
                    res+=dp[v.sc][1];
                }
        for(int i=0;i<(int)s.size()-sl;i++)
            res+=s[i];
        return res;
    }

    void DFS(int u,int p)
    {
        for(auto v:g[u])
            if(v.sc!=p)
                DFS(v.sc,u);
        vector<ll>s;
        for(auto v:g[u])
            if(v.sc!=p&&dp[v.sc][0]>dp[v.sc][1])
                s.pb(dp[v.sc][0]-dp[v.sc][1]);
        if((int)s.size()>k-(u!=0))
            sort(s.begin(),s.end());
        //0
        dp[u][0]=solve(u,p,k,s)+cost[u];
        //1
        dp[u][1]=solve(u,p,k-(u!=0),s);
    }
}nho;

ll get(int u,int sl)
{
    if(sl>=sum[u].size())
        return 0;
    if(sl==0)
        return sum[u].back();
    return sum[u].back()-sum[u][sl-1];
}

ll solve(int u,int p,int sl)
{
    if(sl<0)
        return 2e14;
    ll cong=0,res=2e14;
    vector<ll>s;
    for(auto v:edge[u])
        if(v.sc!=p)
        {
             if(dp[v.sc][0]<=dp[v.sc][1])
                {
                    cong+=dp[v.sc][0];
                }else
                {
                    cong+=dp[v.sc][1];
                    s.pb(dp[v.sc][0]-dp[v.sc][1]);
                }
        }
    sort(s.begin(),s.end());
    if((int)s.size()<=sl)
        res=min(res,cong+get(u,sl-(int)s.size()));
    for(int i=0;i<s.size();i++)
    {
        cong+=s[i];
        if((int)s.size()-i-1<=sl)
            res=min(res,cong+get(u,sl-((int)s.size()-i-1)));

    }
    return res;
}

void DFS(int u,int p)
{
    ktr[u]=k;
    for(auto v:edge[u])
        if(v.sc!=p)
        {
            cost[v.sc]=v.fs;
            DFS(v.sc,u);
        }
    //0
    dp[u][0]=solve(u,p,k)+cost[u];
    //1
    dp[u][1]=solve(u,p,k-(p!=-1));
}

vector<long long> minimum_closure_costs(int NNN, vector<int> UUU, vector<int> VVV, vector<int> WWW)
{
    n=NNN;
    for(int i=0;i<n-1;i++)
    {
        int u=UUU[i],v=VVV[i],w=WWW[i];
        g[u].pb({w,v});
        g[v].pb({w,u});
    }
    cost[0]=1e18;
    nho.build(0,-1);
    vector<ll>kq;
    for(k=0;k<=0;k++)
    {
        nho.DFS(0,-1);
        kq.pb(dp[0][1]);
    }
    for(int i=0;i<n;i++)
        ds[(int)g[i].size()].pb(i);
    for(int i=0;i<n;i++)
        spec[i]=1;
    for(k=1;k<n;k++)
    {
        if(!ds[k].empty())
        {
            for(auto u:ds[k])
                spec[u]=0;
            for(int i=0;i<n;i++)
                sum[i].clear(),edge[i].clear();
            them=tong=0;
             for(int i=0;i<n-1;i++)
                {
                    int u=UUU[i],v=VVV[i],w=WWW[i];
                    tong+=1ll*w;
                    if((int)g[u].size()<(int)g[v].size())
                        swap(u,v);
                    if(spec[u]&&spec[v])
                    {
                        edge[u].pb({w,v});
                        edge[v].pb({w,u});
                        continue;
                    }
                    if(spec[u])
                    {
                        sum[u].pb(w);
                        continue;
                    }
                    them+=1ll*w;
                }
             for(int i=0;i<n;i++)
            {
                sort(sum[i].begin(),sum[i].end(),greater<ll>());
                for(int j=1;j<sum[i].size();j++)
                    sum[i][j]+=sum[i][j-1];
            }
            lis.clear();
            for(int i=0;i<n;i++)
                if(spec[i]==1)
                    lis.pb(i);
             memset(cost,0x3f3f,sizeof(cost));
        }
         ll res=0;
        for(auto u:lis)
            if(ktr[u]!=k)
                DFS(u,-1),res+=dp[u][1];
        kq.pb(res);
    }
    return kq;
}

#ifdef SKY
int main()
{
    freopen("A.inp","r",stdin);
    freopen("A.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    vector<int>U(n-1),V(n-1),W(n-1);
    for(int i=0;i<n-1;i++)
        cin>>U[i]>>V[i]>>W[i];
    vector<ll>kq=minimum_closure_costs(n,U,V,W);
    for(auto u:kq)cout<<u<<" ";
    return 0;
}
#endif

Compilation message

roads.cpp: In member function 'long long int nho::solve(int, int, int, const std::vector<long long int>&)':
roads.cpp:48:15: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   48 |             if(v.sc!=p)
      |               ^
roads.cpp: In function 'long long int get(int, int)':
roads.cpp:81:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   81 |     if(sl>=sum[u].size())
      |        ~~^~~~~~~~~~~~~~~
roads.cpp: In function 'long long int solve(int, int, int)':
roads.cpp:109:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  109 |     for(int i=0;i<s.size();i++)
      |                 ~^~~~~~~~~
roads.cpp: In function 'std::vector<long long int> minimum_closure_costs(int, std::vector<int>, std::vector<int>, std::vector<int>)':
roads.cpp:186:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  186 |                 for(int j=1;j<sum[i].size();j++)
      |                             ~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 7 ms 10452 KB Output is correct
2 Correct 8 ms 10756 KB Output is correct
3 Correct 8 ms 10708 KB Output is correct
4 Correct 9 ms 10708 KB Output is correct
5 Correct 6 ms 10452 KB Output is correct
6 Correct 6 ms 10452 KB Output is correct
7 Correct 6 ms 10452 KB Output is correct
8 Correct 7 ms 10708 KB Output is correct
9 Correct 9 ms 10708 KB Output is correct
10 Correct 6 ms 10452 KB Output is correct
11 Correct 8 ms 10484 KB Output is correct
12 Correct 43 ms 17572 KB Output is correct
13 Correct 89 ms 22400 KB Output is correct
14 Correct 77 ms 21476 KB Output is correct
15 Correct 83 ms 22492 KB Output is correct
16 Correct 81 ms 22760 KB Output is correct
17 Correct 85 ms 22776 KB Output is correct
18 Correct 5 ms 10396 KB Output is correct
19 Correct 68 ms 21372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 10452 KB Output is correct
2 Correct 71 ms 30512 KB Output is correct
3 Correct 88 ms 32816 KB Output is correct
4 Correct 83 ms 34260 KB Output is correct
5 Correct 81 ms 34288 KB Output is correct
6 Correct 6 ms 10836 KB Output is correct
7 Correct 7 ms 10964 KB Output is correct
8 Correct 7 ms 10836 KB Output is correct
9 Correct 6 ms 10452 KB Output is correct
10 Correct 6 ms 10452 KB Output is correct
11 Correct 7 ms 10452 KB Output is correct
12 Correct 49 ms 24876 KB Output is correct
13 Correct 102 ms 34340 KB Output is correct
14 Correct 8 ms 10492 KB Output is correct
15 Correct 72 ms 32092 KB Output is correct
16 Correct 83 ms 34312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 10452 KB Output is correct
2 Correct 6 ms 10464 KB Output is correct
3 Correct 5 ms 10452 KB Output is correct
4 Correct 6 ms 10452 KB Output is correct
5 Correct 6 ms 10480 KB Output is correct
6 Correct 6 ms 10560 KB Output is correct
7 Correct 5 ms 10452 KB Output is correct
8 Correct 6 ms 10452 KB Output is correct
9 Correct 7 ms 10480 KB Output is correct
10 Correct 6 ms 10452 KB Output is correct
11 Correct 7 ms 10468 KB Output is correct
12 Correct 6 ms 10452 KB Output is correct
13 Correct 6 ms 10452 KB Output is correct
14 Correct 6 ms 10452 KB Output is correct
15 Correct 6 ms 10452 KB Output is correct
16 Correct 5 ms 10416 KB Output is correct
17 Correct 6 ms 10452 KB Output is correct
18 Correct 6 ms 10532 KB Output is correct
19 Correct 6 ms 10452 KB Output is correct
20 Correct 6 ms 10528 KB Output is correct
21 Correct 6 ms 10452 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 10452 KB Output is correct
2 Correct 6 ms 10464 KB Output is correct
3 Correct 5 ms 10452 KB Output is correct
4 Correct 6 ms 10452 KB Output is correct
5 Correct 6 ms 10480 KB Output is correct
6 Correct 6 ms 10560 KB Output is correct
7 Correct 5 ms 10452 KB Output is correct
8 Correct 6 ms 10452 KB Output is correct
9 Correct 7 ms 10480 KB Output is correct
10 Correct 6 ms 10452 KB Output is correct
11 Correct 7 ms 10468 KB Output is correct
12 Correct 6 ms 10452 KB Output is correct
13 Correct 6 ms 10452 KB Output is correct
14 Correct 6 ms 10452 KB Output is correct
15 Correct 6 ms 10452 KB Output is correct
16 Correct 5 ms 10416 KB Output is correct
17 Correct 6 ms 10452 KB Output is correct
18 Correct 6 ms 10532 KB Output is correct
19 Correct 6 ms 10452 KB Output is correct
20 Correct 6 ms 10528 KB Output is correct
21 Correct 6 ms 10452 KB Output is correct
22 Correct 6 ms 10452 KB Output is correct
23 Correct 9 ms 10708 KB Output is correct
24 Correct 10 ms 10820 KB Output is correct
25 Correct 10 ms 10708 KB Output is correct
26 Correct 9 ms 10704 KB Output is correct
27 Correct 7 ms 10708 KB Output is correct
28 Correct 7 ms 10708 KB Output is correct
29 Correct 9 ms 10700 KB Output is correct
30 Correct 8 ms 10708 KB Output is correct
31 Correct 12 ms 10652 KB Output is correct
32 Correct 8 ms 10732 KB Output is correct
33 Correct 7 ms 10836 KB Output is correct
34 Correct 8 ms 10964 KB Output is correct
35 Correct 8 ms 10836 KB Output is correct
36 Correct 7 ms 10752 KB Output is correct
37 Correct 7 ms 10700 KB Output is correct
38 Correct 7 ms 10708 KB Output is correct
39 Correct 5 ms 10452 KB Output is correct
40 Correct 6 ms 10452 KB Output is correct
41 Correct 6 ms 10452 KB Output is correct
42 Correct 6 ms 10536 KB Output is correct
43 Correct 6 ms 10528 KB Output is correct
44 Correct 6 ms 10452 KB Output is correct
45 Correct 6 ms 10452 KB Output is correct
46 Correct 6 ms 10452 KB Output is correct
47 Correct 6 ms 10432 KB Output is correct
48 Correct 6 ms 10452 KB Output is correct
49 Correct 6 ms 10452 KB Output is correct
50 Correct 6 ms 10452 KB Output is correct
51 Correct 5 ms 10452 KB Output is correct
52 Correct 6 ms 10452 KB Output is correct
53 Correct 9 ms 10708 KB Output is correct
54 Correct 8 ms 10836 KB Output is correct
55 Correct 7 ms 10680 KB Output is correct
56 Correct 6 ms 10708 KB Output is correct
57 Correct 7 ms 10708 KB Output is correct
58 Correct 6 ms 10452 KB Output is correct
59 Correct 8 ms 10452 KB Output is correct
60 Correct 6 ms 10452 KB Output is correct
61 Correct 6 ms 10452 KB Output is correct
62 Correct 7 ms 10524 KB Output is correct
63 Correct 6 ms 10452 KB Output is correct
64 Correct 8 ms 10808 KB Output is correct
65 Correct 9 ms 10836 KB Output is correct
66 Correct 10 ms 10708 KB Output is correct
67 Correct 9 ms 10708 KB Output is correct
68 Correct 8 ms 10708 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 208 ms 26652 KB Output is correct
2 Correct 191 ms 26408 KB Output is correct
3 Correct 102 ms 23768 KB Output is correct
4 Correct 199 ms 28360 KB Output is correct
5 Correct 86 ms 25280 KB Output is correct
6 Correct 97 ms 23392 KB Output is correct
7 Correct 139 ms 27372 KB Output is correct
8 Correct 69 ms 23172 KB Output is correct
9 Correct 155 ms 29968 KB Output is correct
10 Correct 167 ms 27424 KB Output is correct
11 Correct 1375 ms 24788 KB Output is correct
12 Correct 112 ms 24252 KB Output is correct
13 Correct 6 ms 10472 KB Output is correct
14 Correct 71 ms 33276 KB Output is correct
15 Correct 79 ms 35700 KB Output is correct
16 Correct 10 ms 10836 KB Output is correct
17 Correct 9 ms 10836 KB Output is correct
18 Correct 13 ms 10752 KB Output is correct
19 Correct 8 ms 10748 KB Output is correct
20 Correct 9 ms 10744 KB Output is correct
21 Correct 59 ms 22276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 208 ms 26652 KB Output is correct
2 Correct 191 ms 26408 KB Output is correct
3 Correct 102 ms 23768 KB Output is correct
4 Correct 199 ms 28360 KB Output is correct
5 Correct 86 ms 25280 KB Output is correct
6 Correct 97 ms 23392 KB Output is correct
7 Correct 139 ms 27372 KB Output is correct
8 Correct 69 ms 23172 KB Output is correct
9 Correct 155 ms 29968 KB Output is correct
10 Correct 167 ms 27424 KB Output is correct
11 Correct 1375 ms 24788 KB Output is correct
12 Correct 112 ms 24252 KB Output is correct
13 Correct 6 ms 10472 KB Output is correct
14 Correct 71 ms 33276 KB Output is correct
15 Correct 79 ms 35700 KB Output is correct
16 Correct 10 ms 10836 KB Output is correct
17 Correct 9 ms 10836 KB Output is correct
18 Correct 13 ms 10752 KB Output is correct
19 Correct 8 ms 10748 KB Output is correct
20 Correct 9 ms 10744 KB Output is correct
21 Correct 59 ms 22276 KB Output is correct
22 Correct 6 ms 10452 KB Output is correct
23 Correct 6 ms 10452 KB Output is correct
24 Correct 6 ms 10452 KB Output is correct
25 Correct 147 ms 25952 KB Output is correct
26 Correct 134 ms 24688 KB Output is correct
27 Correct 189 ms 28528 KB Output is correct
28 Correct 110 ms 25256 KB Output is correct
29 Correct 85 ms 24124 KB Output is correct
30 Correct 87 ms 23000 KB Output is correct
31 Correct 81 ms 23340 KB Output is correct
32 Correct 169 ms 26568 KB Output is correct
33 Correct 71 ms 23424 KB Output is correct
34 Correct 169 ms 27516 KB Output is correct
35 Correct 189 ms 30804 KB Output is correct
36 Execution timed out 2053 ms 23564 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 7 ms 10452 KB Output is correct
2 Correct 8 ms 10756 KB Output is correct
3 Correct 8 ms 10708 KB Output is correct
4 Correct 9 ms 10708 KB Output is correct
5 Correct 6 ms 10452 KB Output is correct
6 Correct 6 ms 10452 KB Output is correct
7 Correct 6 ms 10452 KB Output is correct
8 Correct 7 ms 10708 KB Output is correct
9 Correct 9 ms 10708 KB Output is correct
10 Correct 6 ms 10452 KB Output is correct
11 Correct 8 ms 10484 KB Output is correct
12 Correct 43 ms 17572 KB Output is correct
13 Correct 89 ms 22400 KB Output is correct
14 Correct 77 ms 21476 KB Output is correct
15 Correct 83 ms 22492 KB Output is correct
16 Correct 81 ms 22760 KB Output is correct
17 Correct 85 ms 22776 KB Output is correct
18 Correct 5 ms 10396 KB Output is correct
19 Correct 68 ms 21372 KB Output is correct
20 Correct 6 ms 10452 KB Output is correct
21 Correct 71 ms 30512 KB Output is correct
22 Correct 88 ms 32816 KB Output is correct
23 Correct 83 ms 34260 KB Output is correct
24 Correct 81 ms 34288 KB Output is correct
25 Correct 6 ms 10836 KB Output is correct
26 Correct 7 ms 10964 KB Output is correct
27 Correct 7 ms 10836 KB Output is correct
28 Correct 6 ms 10452 KB Output is correct
29 Correct 6 ms 10452 KB Output is correct
30 Correct 7 ms 10452 KB Output is correct
31 Correct 49 ms 24876 KB Output is correct
32 Correct 102 ms 34340 KB Output is correct
33 Correct 8 ms 10492 KB Output is correct
34 Correct 72 ms 32092 KB Output is correct
35 Correct 83 ms 34312 KB Output is correct
36 Correct 7 ms 10452 KB Output is correct
37 Correct 6 ms 10464 KB Output is correct
38 Correct 5 ms 10452 KB Output is correct
39 Correct 6 ms 10452 KB Output is correct
40 Correct 6 ms 10480 KB Output is correct
41 Correct 6 ms 10560 KB Output is correct
42 Correct 5 ms 10452 KB Output is correct
43 Correct 6 ms 10452 KB Output is correct
44 Correct 7 ms 10480 KB Output is correct
45 Correct 6 ms 10452 KB Output is correct
46 Correct 7 ms 10468 KB Output is correct
47 Correct 6 ms 10452 KB Output is correct
48 Correct 6 ms 10452 KB Output is correct
49 Correct 6 ms 10452 KB Output is correct
50 Correct 6 ms 10452 KB Output is correct
51 Correct 5 ms 10416 KB Output is correct
52 Correct 6 ms 10452 KB Output is correct
53 Correct 6 ms 10532 KB Output is correct
54 Correct 6 ms 10452 KB Output is correct
55 Correct 6 ms 10528 KB Output is correct
56 Correct 6 ms 10452 KB Output is correct
57 Correct 6 ms 10452 KB Output is correct
58 Correct 9 ms 10708 KB Output is correct
59 Correct 10 ms 10820 KB Output is correct
60 Correct 10 ms 10708 KB Output is correct
61 Correct 9 ms 10704 KB Output is correct
62 Correct 7 ms 10708 KB Output is correct
63 Correct 7 ms 10708 KB Output is correct
64 Correct 9 ms 10700 KB Output is correct
65 Correct 8 ms 10708 KB Output is correct
66 Correct 12 ms 10652 KB Output is correct
67 Correct 8 ms 10732 KB Output is correct
68 Correct 7 ms 10836 KB Output is correct
69 Correct 8 ms 10964 KB Output is correct
70 Correct 8 ms 10836 KB Output is correct
71 Correct 7 ms 10752 KB Output is correct
72 Correct 7 ms 10700 KB Output is correct
73 Correct 7 ms 10708 KB Output is correct
74 Correct 5 ms 10452 KB Output is correct
75 Correct 6 ms 10452 KB Output is correct
76 Correct 6 ms 10452 KB Output is correct
77 Correct 6 ms 10536 KB Output is correct
78 Correct 6 ms 10528 KB Output is correct
79 Correct 6 ms 10452 KB Output is correct
80 Correct 6 ms 10452 KB Output is correct
81 Correct 6 ms 10452 KB Output is correct
82 Correct 6 ms 10432 KB Output is correct
83 Correct 6 ms 10452 KB Output is correct
84 Correct 6 ms 10452 KB Output is correct
85 Correct 6 ms 10452 KB Output is correct
86 Correct 5 ms 10452 KB Output is correct
87 Correct 6 ms 10452 KB Output is correct
88 Correct 9 ms 10708 KB Output is correct
89 Correct 8 ms 10836 KB Output is correct
90 Correct 7 ms 10680 KB Output is correct
91 Correct 6 ms 10708 KB Output is correct
92 Correct 7 ms 10708 KB Output is correct
93 Correct 6 ms 10452 KB Output is correct
94 Correct 8 ms 10452 KB Output is correct
95 Correct 6 ms 10452 KB Output is correct
96 Correct 6 ms 10452 KB Output is correct
97 Correct 7 ms 10524 KB Output is correct
98 Correct 6 ms 10452 KB Output is correct
99 Correct 8 ms 10808 KB Output is correct
100 Correct 9 ms 10836 KB Output is correct
101 Correct 10 ms 10708 KB Output is correct
102 Correct 9 ms 10708 KB Output is correct
103 Correct 8 ms 10708 KB Output is correct
104 Correct 208 ms 26652 KB Output is correct
105 Correct 191 ms 26408 KB Output is correct
106 Correct 102 ms 23768 KB Output is correct
107 Correct 199 ms 28360 KB Output is correct
108 Correct 86 ms 25280 KB Output is correct
109 Correct 97 ms 23392 KB Output is correct
110 Correct 139 ms 27372 KB Output is correct
111 Correct 69 ms 23172 KB Output is correct
112 Correct 155 ms 29968 KB Output is correct
113 Correct 167 ms 27424 KB Output is correct
114 Correct 1375 ms 24788 KB Output is correct
115 Correct 112 ms 24252 KB Output is correct
116 Correct 6 ms 10472 KB Output is correct
117 Correct 71 ms 33276 KB Output is correct
118 Correct 79 ms 35700 KB Output is correct
119 Correct 10 ms 10836 KB Output is correct
120 Correct 9 ms 10836 KB Output is correct
121 Correct 13 ms 10752 KB Output is correct
122 Correct 8 ms 10748 KB Output is correct
123 Correct 9 ms 10744 KB Output is correct
124 Correct 59 ms 22276 KB Output is correct
125 Correct 6 ms 10452 KB Output is correct
126 Correct 6 ms 10452 KB Output is correct
127 Correct 6 ms 10452 KB Output is correct
128 Correct 147 ms 25952 KB Output is correct
129 Correct 134 ms 24688 KB Output is correct
130 Correct 189 ms 28528 KB Output is correct
131 Correct 110 ms 25256 KB Output is correct
132 Correct 85 ms 24124 KB Output is correct
133 Correct 87 ms 23000 KB Output is correct
134 Correct 81 ms 23340 KB Output is correct
135 Correct 169 ms 26568 KB Output is correct
136 Correct 71 ms 23424 KB Output is correct
137 Correct 169 ms 27516 KB Output is correct
138 Correct 189 ms 30804 KB Output is correct
139 Execution timed out 2053 ms 23564 KB Time limit exceeded
140 Halted 0 ms 0 KB -