Submission #928150

# Submission time Handle Problem Language Result Execution time Memory
928150 2024-02-15T21:57:56 Z aykhn Soccer Stadium (IOI23_soccer) C++17
48 / 100
30 ms 14428 KB
#include <bits/stdc++.h>
#include "soccer.h"

using namespace std;

int n;
vector<vector<int>> A;
int dp[31][31][31][31];
int cur;

int f(int i, int pos, int l, int r)
{
    if (i < 0 || i >= n) return 0;
    if (l > r) return 0;
    if (pos >= n) return 0;
    if (dp[i][pos][l][r] != -1) return dp[i][pos][l][r];
    vector<int> v;
    v.push_back(l - 1);
    for (int j = l; j <= r; j++) if (A[i][j]) v.push_back(j);
    v.push_back(r + 1);
    int res = 0;
    for (int j = 1; j < v.size(); j++)
    {
        if (i <= cur) 
        {
            res = max(res, f(i - 1, pos + 1, v[j - 1] + 1, v[j] - 1) + (v[j] - v[j - 1] - 1));
            res = max(res, f(cur + (pos - (cur - i)) + 1, pos + 1, v[j - 1] + 1, v[j] - 1) + (v[j] - v[j - 1] - 1));
        }
        else
        {
            res = max(res, f(i + 1, pos + 1, v[j - 1] + 1, v[j] - 1) + (v[j] - v[j - 1] - 1));
            res = max(res, f(cur - (pos - (i - cur)) - 1, pos + 1, v[j - 1] + 1, v[j] - 1) + (v[j] - v[j - 1] - 1));
        }
    }
    return dp[i][pos][l][r] = res;
}

int solve()
{
    for (int i = 0; i < 31; i++)
    {
        for (int j = 0; j < 31; j++)
        {
            for (int k = 0; k < 31; k++)
            {
                for (int l = k; l < 31; l++) dp[i][j][k][l] = -1;
            }
        }
    }
    return f(cur, 0, 0, n - 1);
}

int biggest_stadium(int N, vector<vector<int>> B)
{
    n = N;
    A = B;
    int res = 0;
    for (cur = 0; cur < n; cur++)
    {
        res = max(res, solve());
    }
    return res;
}

Compilation message

soccer.cpp: In function 'int f(int, int, int, int)':
soccer.cpp:22:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for (int j = 1; j < v.size(); j++)
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3932 KB ok
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3932 KB ok
2 Correct 2 ms 3932 KB ok
3 Correct 4 ms 3932 KB ok
4 Correct 4 ms 3928 KB ok
5 Correct 1 ms 3932 KB ok
6 Correct 2 ms 3932 KB ok
7 Runtime error 5 ms 8040 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3932 KB ok
2 Correct 2 ms 3932 KB ok
3 Correct 2 ms 3932 KB ok
4 Correct 2 ms 3932 KB ok
5 Correct 2 ms 3932 KB ok
6 Correct 2 ms 3932 KB ok
7 Correct 2 ms 3932 KB ok
8 Correct 2 ms 3932 KB ok
9 Correct 2 ms 3932 KB ok
10 Correct 2 ms 3932 KB ok
11 Correct 2 ms 3932 KB ok
12 Correct 2 ms 3932 KB ok
13 Correct 2 ms 4032 KB ok
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3932 KB ok
2 Correct 2 ms 3932 KB ok
3 Correct 2 ms 3932 KB ok
4 Correct 2 ms 3932 KB ok
5 Correct 2 ms 3932 KB ok
6 Correct 2 ms 3932 KB ok
7 Correct 2 ms 3932 KB ok
8 Correct 2 ms 3932 KB ok
9 Correct 2 ms 3932 KB ok
10 Correct 2 ms 3932 KB ok
11 Correct 2 ms 3932 KB ok
12 Correct 2 ms 3932 KB ok
13 Correct 2 ms 3932 KB ok
14 Correct 2 ms 4032 KB ok
15 Correct 3 ms 3932 KB ok
16 Correct 3 ms 3932 KB ok
17 Correct 3 ms 3932 KB ok
18 Correct 3 ms 3932 KB ok
19 Correct 3 ms 4184 KB ok
20 Correct 3 ms 3932 KB ok
21 Correct 3 ms 3932 KB ok
22 Correct 3 ms 3932 KB ok
23 Correct 3 ms 3932 KB ok
24 Correct 3 ms 3932 KB ok
25 Correct 3 ms 3932 KB ok
26 Correct 3 ms 4188 KB ok
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3932 KB ok
2 Correct 2 ms 3932 KB ok
3 Correct 2 ms 3932 KB ok
4 Correct 4 ms 3932 KB ok
5 Correct 4 ms 3928 KB ok
6 Correct 2 ms 3932 KB ok
7 Correct 2 ms 3932 KB ok
8 Correct 2 ms 3932 KB ok
9 Correct 2 ms 3932 KB ok
10 Correct 2 ms 3932 KB ok
11 Correct 2 ms 3932 KB ok
12 Correct 2 ms 3932 KB ok
13 Correct 2 ms 3932 KB ok
14 Correct 2 ms 3932 KB ok
15 Correct 2 ms 3932 KB ok
16 Correct 2 ms 4032 KB ok
17 Correct 3 ms 3932 KB ok
18 Correct 3 ms 3932 KB ok
19 Correct 3 ms 3932 KB ok
20 Correct 3 ms 3932 KB ok
21 Correct 3 ms 4184 KB ok
22 Correct 3 ms 3932 KB ok
23 Correct 3 ms 3932 KB ok
24 Correct 3 ms 3932 KB ok
25 Correct 3 ms 3932 KB ok
26 Correct 3 ms 3932 KB ok
27 Correct 3 ms 3932 KB ok
28 Correct 3 ms 4188 KB ok
29 Correct 3 ms 3932 KB ok
30 Correct 12 ms 3932 KB ok
31 Correct 11 ms 3936 KB ok
32 Correct 10 ms 4060 KB ok
33 Correct 10 ms 4128 KB ok
34 Correct 11 ms 3932 KB ok
35 Correct 11 ms 3932 KB ok
36 Correct 10 ms 3932 KB ok
37 Correct 10 ms 3932 KB ok
38 Correct 10 ms 4060 KB ok
39 Correct 10 ms 3932 KB ok
40 Correct 10 ms 3944 KB ok
41 Correct 11 ms 3932 KB ok
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3932 KB ok
2 Correct 2 ms 3932 KB ok
3 Correct 2 ms 3932 KB ok
4 Correct 4 ms 3932 KB ok
5 Correct 4 ms 3928 KB ok
6 Correct 2 ms 3932 KB ok
7 Correct 2 ms 3932 KB ok
8 Correct 2 ms 3932 KB ok
9 Correct 2 ms 3932 KB ok
10 Correct 2 ms 3932 KB ok
11 Correct 2 ms 3932 KB ok
12 Correct 2 ms 3932 KB ok
13 Correct 2 ms 3932 KB ok
14 Correct 2 ms 3932 KB ok
15 Correct 2 ms 3932 KB ok
16 Correct 2 ms 4032 KB ok
17 Correct 3 ms 3932 KB ok
18 Correct 3 ms 3932 KB ok
19 Correct 3 ms 3932 KB ok
20 Correct 3 ms 3932 KB ok
21 Correct 3 ms 4184 KB ok
22 Correct 3 ms 3932 KB ok
23 Correct 3 ms 3932 KB ok
24 Correct 3 ms 3932 KB ok
25 Correct 3 ms 3932 KB ok
26 Correct 3 ms 3932 KB ok
27 Correct 3 ms 3932 KB ok
28 Correct 3 ms 4188 KB ok
29 Correct 3 ms 3932 KB ok
30 Correct 12 ms 3932 KB ok
31 Correct 11 ms 3936 KB ok
32 Correct 10 ms 4060 KB ok
33 Correct 10 ms 4128 KB ok
34 Correct 11 ms 3932 KB ok
35 Correct 11 ms 3932 KB ok
36 Correct 10 ms 3932 KB ok
37 Correct 10 ms 3932 KB ok
38 Correct 10 ms 4060 KB ok
39 Correct 10 ms 3932 KB ok
40 Correct 10 ms 3944 KB ok
41 Correct 11 ms 3932 KB ok
42 Runtime error 30 ms 14428 KB Execution killed with signal 11
43 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3932 KB ok
2 Correct 2 ms 3932 KB ok
3 Correct 2 ms 3932 KB ok
4 Correct 4 ms 3932 KB ok
5 Correct 4 ms 3928 KB ok
6 Correct 1 ms 3932 KB ok
7 Correct 2 ms 3932 KB ok
8 Runtime error 5 ms 8040 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -