Submission #839758

# Submission time Handle Problem Language Result Execution time Memory
839758 2023-08-30T15:50:19 Z model_code Soccer Stadium (IOI23_soccer) C++17
48 / 100
4500 ms 799920 KB
// correct/n6_dp_rec.cpp

#include "soccer.h"

#include <cstring>

class solver
{
    int N;
    std::vector<std::vector<int>> C;
    int dp[100][100][100][100];

    int solve(int d, int u, int l, int r)
    {
        if (dp[d][u][l][r] != -1)
            return dp[d][u][l][r];
        int curr = r - l + 1;

        int ans = curr;
        if (d > 0)
        {
            for (int i = l; i <= r; ++i)
            {
                for (int j = i; j <= r; ++j)
                {
                    if (1 == C[d - 1][j])
                        break;
                    ans = std::max(ans, curr + solve(d - 1, u, i, j));
                }
            }
        }
        if (u + 1 < N)
        {
            for (int i = l; i <= r; ++i)
            {
                for (int j = i; j <= r; ++j)
                {
                    if (1 == C[u + 1][j])
                        break;
                    ans = std::max(ans, curr + solve(d, u + 1, i, j));
                }
            }
        }

        return dp[d][u][l][r] = ans;
    }

public:
    solver(int N, std::vector<std::vector<int>> C) : N(N), C(std::move(C))
    {
        memset(dp, -1, sizeof dp);
    }

    int solve()
    {
        int ans = 0;
        for (int i = 0; i < N; ++i)
        {
            for (int j = 0; j < N; ++j)
            {
                for (int k = j; k < N; ++k)
                {
                    if (1 == C[i][k])
                        break;
                    ans = std::max(ans, solve(i, i, j, k));
                }
            }
        }

        return ans;
    }
};

int biggest_stadium(int N, std::vector<std::vector<int>> C)
{
    solver s(N, C);
    return s.solve();
}
# Verdict Execution time Memory Grader output
1 Correct 279 ms 391620 KB ok
# Verdict Execution time Memory Grader output
1 Correct 259 ms 391648 KB ok
2 Correct 207 ms 391656 KB ok
3 Correct 193 ms 391592 KB ok
4 Correct 181 ms 391604 KB ok
5 Correct 204 ms 391544 KB ok
6 Correct 175 ms 391560 KB ok
7 Execution timed out 4618 ms 391780 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 259 ms 391648 KB ok
2 Correct 207 ms 391656 KB ok
3 Correct 164 ms 391584 KB ok
4 Correct 167 ms 391572 KB ok
5 Correct 157 ms 391648 KB ok
6 Correct 150 ms 391536 KB ok
7 Correct 156 ms 391624 KB ok
8 Correct 185 ms 391596 KB ok
9 Correct 178 ms 391584 KB ok
10 Correct 193 ms 391616 KB ok
11 Correct 184 ms 391648 KB ok
12 Correct 176 ms 391656 KB ok
13 Correct 177 ms 391644 KB ok
# Verdict Execution time Memory Grader output
1 Correct 279 ms 391620 KB ok
2 Correct 259 ms 391648 KB ok
3 Correct 207 ms 391656 KB ok
4 Correct 164 ms 391584 KB ok
5 Correct 167 ms 391572 KB ok
6 Correct 157 ms 391648 KB ok
7 Correct 150 ms 391536 KB ok
8 Correct 156 ms 391624 KB ok
9 Correct 185 ms 391596 KB ok
10 Correct 178 ms 391584 KB ok
11 Correct 193 ms 391616 KB ok
12 Correct 184 ms 391648 KB ok
13 Correct 176 ms 391656 KB ok
14 Correct 177 ms 391644 KB ok
15 Correct 186 ms 391652 KB ok
16 Correct 204 ms 391680 KB ok
17 Correct 158 ms 391624 KB ok
18 Correct 155 ms 391564 KB ok
19 Correct 150 ms 391672 KB ok
20 Correct 182 ms 391628 KB ok
21 Correct 154 ms 391652 KB ok
22 Correct 203 ms 391648 KB ok
23 Correct 179 ms 391616 KB ok
24 Correct 163 ms 391652 KB ok
25 Correct 197 ms 391652 KB ok
26 Correct 187 ms 391648 KB ok
# Verdict Execution time Memory Grader output
1 Correct 279 ms 391620 KB ok
2 Correct 259 ms 391648 KB ok
3 Correct 207 ms 391656 KB ok
4 Correct 193 ms 391592 KB ok
5 Correct 181 ms 391604 KB ok
6 Correct 164 ms 391584 KB ok
7 Correct 167 ms 391572 KB ok
8 Correct 157 ms 391648 KB ok
9 Correct 150 ms 391536 KB ok
10 Correct 156 ms 391624 KB ok
11 Correct 185 ms 391596 KB ok
12 Correct 178 ms 391584 KB ok
13 Correct 193 ms 391616 KB ok
14 Correct 184 ms 391648 KB ok
15 Correct 176 ms 391656 KB ok
16 Correct 177 ms 391644 KB ok
17 Correct 186 ms 391652 KB ok
18 Correct 204 ms 391680 KB ok
19 Correct 158 ms 391624 KB ok
20 Correct 155 ms 391564 KB ok
21 Correct 150 ms 391672 KB ok
22 Correct 182 ms 391628 KB ok
23 Correct 154 ms 391652 KB ok
24 Correct 203 ms 391648 KB ok
25 Correct 179 ms 391616 KB ok
26 Correct 163 ms 391652 KB ok
27 Correct 197 ms 391652 KB ok
28 Correct 187 ms 391648 KB ok
29 Correct 169 ms 391644 KB ok
30 Correct 196 ms 391560 KB ok
31 Correct 198 ms 391572 KB ok
32 Correct 225 ms 391656 KB ok
33 Correct 182 ms 391620 KB ok
34 Correct 190 ms 391564 KB ok
35 Correct 195 ms 391660 KB ok
36 Correct 200 ms 391660 KB ok
37 Correct 195 ms 391660 KB ok
38 Correct 186 ms 391752 KB ok
39 Correct 191 ms 391592 KB ok
40 Correct 263 ms 391544 KB ok
41 Correct 284 ms 391660 KB ok
# Verdict Execution time Memory Grader output
1 Correct 279 ms 391620 KB ok
2 Correct 259 ms 391648 KB ok
3 Correct 207 ms 391656 KB ok
4 Correct 193 ms 391592 KB ok
5 Correct 181 ms 391604 KB ok
6 Correct 164 ms 391584 KB ok
7 Correct 167 ms 391572 KB ok
8 Correct 157 ms 391648 KB ok
9 Correct 150 ms 391536 KB ok
10 Correct 156 ms 391624 KB ok
11 Correct 185 ms 391596 KB ok
12 Correct 178 ms 391584 KB ok
13 Correct 193 ms 391616 KB ok
14 Correct 184 ms 391648 KB ok
15 Correct 176 ms 391656 KB ok
16 Correct 177 ms 391644 KB ok
17 Correct 186 ms 391652 KB ok
18 Correct 204 ms 391680 KB ok
19 Correct 158 ms 391624 KB ok
20 Correct 155 ms 391564 KB ok
21 Correct 150 ms 391672 KB ok
22 Correct 182 ms 391628 KB ok
23 Correct 154 ms 391652 KB ok
24 Correct 203 ms 391648 KB ok
25 Correct 179 ms 391616 KB ok
26 Correct 163 ms 391652 KB ok
27 Correct 197 ms 391652 KB ok
28 Correct 187 ms 391648 KB ok
29 Correct 169 ms 391644 KB ok
30 Correct 196 ms 391560 KB ok
31 Correct 198 ms 391572 KB ok
32 Correct 225 ms 391656 KB ok
33 Correct 182 ms 391620 KB ok
34 Correct 190 ms 391564 KB ok
35 Correct 195 ms 391660 KB ok
36 Correct 200 ms 391660 KB ok
37 Correct 195 ms 391660 KB ok
38 Correct 186 ms 391752 KB ok
39 Correct 191 ms 391592 KB ok
40 Correct 263 ms 391544 KB ok
41 Correct 284 ms 391660 KB ok
42 Runtime error 841 ms 799920 KB Execution killed with signal 11
43 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 279 ms 391620 KB ok
2 Correct 259 ms 391648 KB ok
3 Correct 207 ms 391656 KB ok
4 Correct 193 ms 391592 KB ok
5 Correct 181 ms 391604 KB ok
6 Correct 204 ms 391544 KB ok
7 Correct 175 ms 391560 KB ok
8 Execution timed out 4618 ms 391780 KB Time limit exceeded
9 Halted 0 ms 0 KB -