Submission #1054451

# Submission time Handle Problem Language Result Execution time Memory
1054451 2024-08-12T10:00:18 Z Ahmed57 Soccer Stadium (IOI23_soccer) C++17
48 / 100
15 ms 12560 KB
#include "bits/stdc++.h"

using namespace std;
int dp[31][31][31][31], n;
vector<pair<int,int>> rngs[31];
int solve(int l,int r,int x,int y){
    if(l==0&&r==n-1)return 0;
    if(dp[l][r][x][y]!=-1)return dp[l][r][x][y];
    int ma = 0;
    if(l){
        for(auto j:rngs[l-1]){
            if(max(x,j.first)<=min(y,j.second)){
                ma = max(ma,solve(l-1,r,max(x,j.first),min(y,j.second))+(min(y,j.second)-max(x,j.first)+1));
            }
        } 
    }if(r<n-1){
        for(auto j:rngs[r+1]){
            if(max(x,j.first)<=min(y,j.second)){
                ma = max(ma,solve(l,r+1,max(x,j.first),min(y,j.second))+(min(y,j.second)-max(x,j.first)+1));
            }
        }
    }
    return dp[l][r][x][y] = ma;
}
int biggest_stadium(int N, vector<vector<int>> v){
    memset(dp,-1,sizeof dp);
    n = N;
    for(int i = 0;i<N;i++){
        int la = 0;
        for(int j = 0;j<N;j++){
            if(v[i][j]==0){
                if(la==-1)la = j;
            }else{
                if(la<j&&la!=-1)rngs[i].push_back({la,j-1});
                la = -1;
            }
        }
        if(la!=-1)rngs[i].push_back({la,N-1});
    }
    int all = 0;
    for(int i = 0;i<N;i++){
        for(auto j:rngs[i]){
            all= max(all,solve(i,i,j.first,j.second)+(j.second-j.first+1));
        }
    }
    return all;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3932 KB ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3928 KB ok
2 Correct 1 ms 3932 KB ok
3 Correct 1 ms 3932 KB ok
4 Correct 1 ms 3932 KB ok
5 Correct 1 ms 3932 KB ok
6 Correct 1 ms 4020 KB ok
7 Runtime error 4 ms 8028 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3928 KB ok
2 Correct 1 ms 3932 KB ok
3 Correct 1 ms 3928 KB ok
4 Correct 1 ms 3932 KB ok
5 Correct 1 ms 3932 KB ok
6 Correct 1 ms 3932 KB ok
7 Correct 1 ms 3932 KB ok
8 Correct 1 ms 3932 KB ok
9 Correct 1 ms 3932 KB ok
10 Correct 1 ms 3932 KB ok
11 Correct 1 ms 3932 KB ok
12 Correct 1 ms 3932 KB ok
13 Correct 1 ms 3932 KB ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3932 KB ok
2 Correct 1 ms 3928 KB ok
3 Correct 1 ms 3932 KB ok
4 Correct 1 ms 3928 KB ok
5 Correct 1 ms 3932 KB ok
6 Correct 1 ms 3932 KB ok
7 Correct 1 ms 3932 KB ok
8 Correct 1 ms 3932 KB ok
9 Correct 1 ms 3932 KB ok
10 Correct 1 ms 3932 KB ok
11 Correct 1 ms 3932 KB ok
12 Correct 1 ms 3932 KB ok
13 Correct 1 ms 3932 KB ok
14 Correct 1 ms 3932 KB ok
15 Correct 1 ms 3932 KB ok
16 Correct 1 ms 3932 KB ok
17 Correct 1 ms 3932 KB ok
18 Correct 1 ms 3932 KB ok
19 Correct 1 ms 3932 KB ok
20 Correct 1 ms 3932 KB ok
21 Correct 1 ms 3932 KB ok
22 Correct 1 ms 3932 KB ok
23 Correct 1 ms 3932 KB ok
24 Correct 1 ms 3932 KB ok
25 Correct 1 ms 3932 KB ok
26 Correct 1 ms 3932 KB ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3932 KB ok
2 Correct 1 ms 3928 KB ok
3 Correct 1 ms 3932 KB ok
4 Correct 1 ms 3932 KB ok
5 Correct 1 ms 3932 KB ok
6 Correct 1 ms 3928 KB ok
7 Correct 1 ms 3932 KB ok
8 Correct 1 ms 3932 KB ok
9 Correct 1 ms 3932 KB ok
10 Correct 1 ms 3932 KB ok
11 Correct 1 ms 3932 KB ok
12 Correct 1 ms 3932 KB ok
13 Correct 1 ms 3932 KB ok
14 Correct 1 ms 3932 KB ok
15 Correct 1 ms 3932 KB ok
16 Correct 1 ms 3932 KB ok
17 Correct 1 ms 3932 KB ok
18 Correct 1 ms 3932 KB ok
19 Correct 1 ms 3932 KB ok
20 Correct 1 ms 3932 KB ok
21 Correct 1 ms 3932 KB ok
22 Correct 1 ms 3932 KB ok
23 Correct 1 ms 3932 KB ok
24 Correct 1 ms 3932 KB ok
25 Correct 1 ms 3932 KB ok
26 Correct 1 ms 3932 KB ok
27 Correct 1 ms 3932 KB ok
28 Correct 1 ms 3932 KB ok
29 Correct 1 ms 3932 KB ok
30 Correct 1 ms 3932 KB ok
31 Correct 1 ms 3932 KB ok
32 Correct 1 ms 3932 KB ok
33 Correct 1 ms 3932 KB ok
34 Correct 1 ms 3932 KB ok
35 Correct 1 ms 3932 KB ok
36 Correct 1 ms 3932 KB ok
37 Correct 1 ms 3932 KB ok
38 Correct 1 ms 3932 KB ok
39 Correct 1 ms 3932 KB ok
40 Correct 1 ms 3932 KB ok
41 Correct 1 ms 3932 KB ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3932 KB ok
2 Correct 1 ms 3928 KB ok
3 Correct 1 ms 3932 KB ok
4 Correct 1 ms 3932 KB ok
5 Correct 1 ms 3932 KB ok
6 Correct 1 ms 3928 KB ok
7 Correct 1 ms 3932 KB ok
8 Correct 1 ms 3932 KB ok
9 Correct 1 ms 3932 KB ok
10 Correct 1 ms 3932 KB ok
11 Correct 1 ms 3932 KB ok
12 Correct 1 ms 3932 KB ok
13 Correct 1 ms 3932 KB ok
14 Correct 1 ms 3932 KB ok
15 Correct 1 ms 3932 KB ok
16 Correct 1 ms 3932 KB ok
17 Correct 1 ms 3932 KB ok
18 Correct 1 ms 3932 KB ok
19 Correct 1 ms 3932 KB ok
20 Correct 1 ms 3932 KB ok
21 Correct 1 ms 3932 KB ok
22 Correct 1 ms 3932 KB ok
23 Correct 1 ms 3932 KB ok
24 Correct 1 ms 3932 KB ok
25 Correct 1 ms 3932 KB ok
26 Correct 1 ms 3932 KB ok
27 Correct 1 ms 3932 KB ok
28 Correct 1 ms 3932 KB ok
29 Correct 1 ms 3932 KB ok
30 Correct 1 ms 3932 KB ok
31 Correct 1 ms 3932 KB ok
32 Correct 1 ms 3932 KB ok
33 Correct 1 ms 3932 KB ok
34 Correct 1 ms 3932 KB ok
35 Correct 1 ms 3932 KB ok
36 Correct 1 ms 3932 KB ok
37 Correct 1 ms 3932 KB ok
38 Correct 1 ms 3932 KB ok
39 Correct 1 ms 3932 KB ok
40 Correct 1 ms 3932 KB ok
41 Correct 1 ms 3932 KB ok
42 Runtime error 15 ms 12560 KB Execution killed with signal 6
43 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 3932 KB ok
2 Correct 1 ms 3928 KB ok
3 Correct 1 ms 3932 KB ok
4 Correct 1 ms 3932 KB ok
5 Correct 1 ms 3932 KB ok
6 Correct 1 ms 3932 KB ok
7 Correct 1 ms 4020 KB ok
8 Runtime error 4 ms 8028 KB Execution killed with signal 6
9 Halted 0 ms 0 KB -