Submission #967467

# Submission time Handle Problem Language Result Execution time Memory
967467 2024-04-22T07:08:54 Z Jarif_Rahman Soccer Stadium (IOI23_soccer) C++17
48 / 100
1282 ms 2097152 KB
#include "soccer.h"
#include <bits/stdc++.h>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;

int biggest_stadium(int n, vector<vector<int>> F){
    vector<vector<vector<vector<int>>>> dp(n,
        vector<vector<vector<int>>>(n, vector<vector<int>>(n, vector<int>(n, 0))));
    auto mx = dp;

    for(int i = 0; i < n; i++){
        for(int l = 0; l < n; l++) for(int r = l; r < n; r++){
            if(F[i][r]) break;
            dp[i][i][l][r] = r-l+1;
            mx[i][i][l][r] = r-l+1;
        }
        for(int l = 0; l < n; l++) for(int r = n-1; r >= l; r--){
            if(l) mx[i][i][l][r] = max(mx[i][i][l][r], mx[i][i][l-1][r]);
            if(r+1 < n) mx[i][i][l][r] = max(mx[i][i][l][r], mx[i][i][l][r+1]);
        }
    }


    for(int a = n-1; a >= 0; a--) for(int b = a+1; b < n; b++) for(int l = 0; l < n; l++) for(int r = n-1; r >= l; r--){
        if(dp[a][a][l][r] != 0 && mx[a+1][b][l][r] != 0) dp[a][b][l][r] = max(dp[a][b][l][r], mx[a+1][b][l][r]+dp[a][a][l][r]);
        if(dp[b][b][l][r] != 0 && mx[a][b-1][l][r] != 0) dp[a][b][l][r] = max(dp[a][b][l][r], mx[a][b-1][l][r]+dp[b][b][l][r]);

        mx[a][b][l][r] = max(mx[a][b][l][r], dp[a][b][l][r]);

        if(l) mx[a][b][l][r] = max(mx[a][b][l][r], mx[a][b][l-1][r]);
        if(r+1 < n) mx[a][b][l][r] = max(mx[a][b][l][r], mx[a][b][l][r+1]);
    }

    int ans = 0;
    for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) for(int k = 0; k < n; k++) for(int l = 0; l < n; l++){
        ans = max(ans, dp[i][j][k][l]);
    }

    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 1 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 832 ms 862292 KB ok
8 Runtime error 1282 ms 2097152 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB ok
2 Correct 0 ms 348 KB ok
3 Correct 0 ms 344 KB ok
4 Correct 0 ms 352 KB ok
5 Correct 0 ms 352 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 1 ms 348 KB ok
11 Correct 1 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 0 ms 348 KB ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 0 ms 344 KB ok
5 Correct 0 ms 352 KB ok
6 Correct 0 ms 352 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 0 ms 348 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 348 KB ok
11 Correct 1 ms 348 KB ok
12 Correct 1 ms 348 KB ok
13 Correct 0 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 1 ms 348 KB ok
16 Correct 1 ms 348 KB ok
17 Correct 0 ms 348 KB ok
18 Correct 0 ms 348 KB ok
19 Correct 1 ms 348 KB ok
20 Correct 0 ms 348 KB ok
21 Correct 0 ms 348 KB ok
22 Correct 0 ms 348 KB ok
23 Correct 1 ms 604 KB ok
24 Correct 0 ms 348 KB ok
25 Correct 1 ms 600 KB ok
26 Correct 1 ms 348 KB ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 0 ms 344 KB ok
7 Correct 0 ms 352 KB ok
8 Correct 0 ms 352 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 348 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 1 ms 348 KB ok
14 Correct 1 ms 348 KB ok
15 Correct 0 ms 348 KB ok
16 Correct 0 ms 348 KB ok
17 Correct 1 ms 348 KB ok
18 Correct 1 ms 348 KB ok
19 Correct 0 ms 348 KB ok
20 Correct 0 ms 348 KB ok
21 Correct 1 ms 348 KB ok
22 Correct 0 ms 348 KB ok
23 Correct 0 ms 348 KB ok
24 Correct 0 ms 348 KB ok
25 Correct 1 ms 604 KB ok
26 Correct 0 ms 348 KB ok
27 Correct 1 ms 600 KB ok
28 Correct 1 ms 348 KB ok
29 Correct 0 ms 344 KB ok
30 Correct 7 ms 8536 KB ok
31 Correct 8 ms 8540 KB ok
32 Correct 7 ms 8540 KB ok
33 Correct 7 ms 8540 KB ok
34 Correct 7 ms 8540 KB ok
35 Correct 7 ms 8540 KB ok
36 Correct 7 ms 8548 KB ok
37 Correct 7 ms 8544 KB ok
38 Correct 7 ms 8516 KB ok
39 Correct 10 ms 8632 KB ok
40 Correct 7 ms 8544 KB ok
41 Correct 7 ms 8540 KB ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 0 ms 344 KB ok
7 Correct 0 ms 352 KB ok
8 Correct 0 ms 352 KB ok
9 Correct 0 ms 348 KB ok
10 Correct 0 ms 348 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 1 ms 348 KB ok
14 Correct 1 ms 348 KB ok
15 Correct 0 ms 348 KB ok
16 Correct 0 ms 348 KB ok
17 Correct 1 ms 348 KB ok
18 Correct 1 ms 348 KB ok
19 Correct 0 ms 348 KB ok
20 Correct 0 ms 348 KB ok
21 Correct 1 ms 348 KB ok
22 Correct 0 ms 348 KB ok
23 Correct 0 ms 348 KB ok
24 Correct 0 ms 348 KB ok
25 Correct 1 ms 604 KB ok
26 Correct 0 ms 348 KB ok
27 Correct 1 ms 600 KB ok
28 Correct 1 ms 348 KB ok
29 Correct 0 ms 344 KB ok
30 Correct 7 ms 8536 KB ok
31 Correct 8 ms 8540 KB ok
32 Correct 7 ms 8540 KB ok
33 Correct 7 ms 8540 KB ok
34 Correct 7 ms 8540 KB ok
35 Correct 7 ms 8540 KB ok
36 Correct 7 ms 8548 KB ok
37 Correct 7 ms 8544 KB ok
38 Correct 7 ms 8516 KB ok
39 Correct 10 ms 8632 KB ok
40 Correct 7 ms 8544 KB ok
41 Correct 7 ms 8540 KB ok
42 Runtime error 940 ms 2097152 KB Execution killed with signal 9
43 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB ok
2 Correct 1 ms 348 KB ok
3 Correct 0 ms 348 KB ok
4 Correct 1 ms 348 KB ok
5 Correct 1 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Correct 832 ms 862292 KB ok
9 Runtime error 1282 ms 2097152 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -