Submission #1054469

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

using namespace std;
map<pair<int,int>,int> dp[501][501];
int 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].find(make_pair(x,y))!=dp[l][r].end())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){
    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 2 ms 12124 KB ok
# Verdict Execution time Memory Grader output
1 Correct 3 ms 12124 KB ok
2 Correct 2 ms 12124 KB ok
3 Correct 3 ms 12124 KB ok
4 Correct 2 ms 12124 KB ok
5 Correct 2 ms 12124 KB ok
6 Correct 1 ms 12124 KB ok
7 Runtime error 9 ms 24580 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 12124 KB ok
2 Correct 2 ms 12124 KB ok
3 Correct 2 ms 12120 KB ok
4 Correct 2 ms 12124 KB ok
5 Correct 2 ms 12124 KB ok
6 Correct 2 ms 12124 KB ok
7 Correct 2 ms 12124 KB ok
8 Correct 2 ms 12124 KB ok
9 Correct 2 ms 12124 KB ok
10 Correct 2 ms 12124 KB ok
11 Correct 2 ms 12124 KB ok
12 Correct 2 ms 12124 KB ok
13 Correct 2 ms 12124 KB ok
# Verdict Execution time Memory Grader output
1 Correct 2 ms 12124 KB ok
2 Correct 3 ms 12124 KB ok
3 Correct 2 ms 12124 KB ok
4 Correct 2 ms 12120 KB ok
5 Correct 2 ms 12124 KB ok
6 Correct 2 ms 12124 KB ok
7 Correct 2 ms 12124 KB ok
8 Correct 2 ms 12124 KB ok
9 Correct 2 ms 12124 KB ok
10 Correct 2 ms 12124 KB ok
11 Correct 2 ms 12124 KB ok
12 Correct 2 ms 12124 KB ok
13 Correct 2 ms 12124 KB ok
14 Correct 2 ms 12124 KB ok
15 Correct 2 ms 12376 KB ok
16 Correct 2 ms 12124 KB ok
17 Correct 2 ms 12124 KB ok
18 Correct 2 ms 12120 KB ok
19 Correct 2 ms 12120 KB ok
20 Correct 2 ms 12124 KB ok
21 Correct 2 ms 12124 KB ok
22 Correct 2 ms 12376 KB ok
23 Correct 2 ms 12124 KB ok
24 Correct 2 ms 12376 KB ok
25 Correct 2 ms 12124 KB ok
26 Correct 2 ms 12124 KB ok
# Verdict Execution time Memory Grader output
1 Correct 2 ms 12124 KB ok
2 Correct 3 ms 12124 KB ok
3 Correct 2 ms 12124 KB ok
4 Correct 3 ms 12124 KB ok
5 Correct 2 ms 12124 KB ok
6 Correct 2 ms 12120 KB ok
7 Correct 2 ms 12124 KB ok
8 Correct 2 ms 12124 KB ok
9 Correct 2 ms 12124 KB ok
10 Correct 2 ms 12124 KB ok
11 Correct 2 ms 12124 KB ok
12 Correct 2 ms 12124 KB ok
13 Correct 2 ms 12124 KB ok
14 Correct 2 ms 12124 KB ok
15 Correct 2 ms 12124 KB ok
16 Correct 2 ms 12124 KB ok
17 Correct 2 ms 12376 KB ok
18 Correct 2 ms 12124 KB ok
19 Correct 2 ms 12124 KB ok
20 Correct 2 ms 12120 KB ok
21 Correct 2 ms 12120 KB ok
22 Correct 2 ms 12124 KB ok
23 Correct 2 ms 12124 KB ok
24 Correct 2 ms 12376 KB ok
25 Correct 2 ms 12124 KB ok
26 Correct 2 ms 12376 KB ok
27 Correct 2 ms 12124 KB ok
28 Correct 2 ms 12124 KB ok
29 Correct 2 ms 12124 KB ok
30 Correct 2 ms 12136 KB ok
31 Correct 2 ms 12124 KB ok
32 Correct 3 ms 12124 KB ok
33 Correct 2 ms 12124 KB ok
34 Correct 2 ms 12124 KB ok
35 Correct 2 ms 12124 KB ok
36 Correct 2 ms 12124 KB ok
37 Correct 2 ms 12124 KB ok
38 Correct 2 ms 12228 KB ok
39 Correct 3 ms 12124 KB ok
40 Correct 2 ms 12124 KB ok
41 Correct 2 ms 12124 KB ok
# Verdict Execution time Memory Grader output
1 Correct 2 ms 12124 KB ok
2 Correct 3 ms 12124 KB ok
3 Correct 2 ms 12124 KB ok
4 Correct 3 ms 12124 KB ok
5 Correct 2 ms 12124 KB ok
6 Correct 2 ms 12120 KB ok
7 Correct 2 ms 12124 KB ok
8 Correct 2 ms 12124 KB ok
9 Correct 2 ms 12124 KB ok
10 Correct 2 ms 12124 KB ok
11 Correct 2 ms 12124 KB ok
12 Correct 2 ms 12124 KB ok
13 Correct 2 ms 12124 KB ok
14 Correct 2 ms 12124 KB ok
15 Correct 2 ms 12124 KB ok
16 Correct 2 ms 12124 KB ok
17 Correct 2 ms 12376 KB ok
18 Correct 2 ms 12124 KB ok
19 Correct 2 ms 12124 KB ok
20 Correct 2 ms 12120 KB ok
21 Correct 2 ms 12120 KB ok
22 Correct 2 ms 12124 KB ok
23 Correct 2 ms 12124 KB ok
24 Correct 2 ms 12376 KB ok
25 Correct 2 ms 12124 KB ok
26 Correct 2 ms 12376 KB ok
27 Correct 2 ms 12124 KB ok
28 Correct 2 ms 12124 KB ok
29 Correct 2 ms 12124 KB ok
30 Correct 2 ms 12136 KB ok
31 Correct 2 ms 12124 KB ok
32 Correct 3 ms 12124 KB ok
33 Correct 2 ms 12124 KB ok
34 Correct 2 ms 12124 KB ok
35 Correct 2 ms 12124 KB ok
36 Correct 2 ms 12124 KB ok
37 Correct 2 ms 12124 KB ok
38 Correct 2 ms 12228 KB ok
39 Correct 3 ms 12124 KB ok
40 Correct 2 ms 12124 KB ok
41 Correct 2 ms 12124 KB ok
42 Runtime error 24 ms 28500 KB Execution killed with signal 6
43 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 12124 KB ok
2 Correct 3 ms 12124 KB ok
3 Correct 2 ms 12124 KB ok
4 Correct 3 ms 12124 KB ok
5 Correct 2 ms 12124 KB ok
6 Correct 2 ms 12124 KB ok
7 Correct 1 ms 12124 KB ok
8 Runtime error 9 ms 24580 KB Execution killed with signal 6
9 Halted 0 ms 0 KB -