Submission #938430

# Submission time Handle Problem Language Result Execution time Memory
938430 2024-03-05T06:30:32 Z GrindMachine Soccer Stadium (IOI23_soccer) C++17
48 / 100
4500 ms 2097152 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define setbits(x) __builtin_popcountll(x)
#define ff first
#define ss second
#define conts continue
#define ceil2(x,y) ((x+y-1)/(y))
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define yes cout << "Yes" << endl
#define no cout << "No" << endl

#define rep(i,n) for(int i = 0; i < n; ++i)
#define rep1(i,n) for(int i = 1; i <= n; ++i)
#define rev(i,s,e) for(int i = s; i >= e; --i)
#define trav(i,a) for(auto &i : a)

template<typename T>
void amin(T &a, T b) {
    a = min(a,b);
}

template<typename T>
void amax(T &a, T b) {
    a = max(a,b);
}

#ifdef LOCAL
#include "debug.h"
#else
#define debug(x) 42
#endif

/*

already know some key ideas

*/

const int MOD = 1e9 + 7;
const int N = 1e5 + 5;
const int inf1 = int(1e9) + 5;
const ll inf2 = ll(1e18) + 5;

#include "soccer.h"

int biggest_stadium(int n, std::vector<std::vector<int>> A)
{
    int a[n+5][n+5];
    memset(a,0,sizeof a);
    rep1(i,n) rep1(j,n) a[i][j] = A[i-1][j-1];

    int p[n+5][n+5];
    memset(p,0,sizeof p);
    rep1(i,n){
        rep1(j,n){
            p[i][j] = p[i][j-1]+a[i][j];
        }
    }

    int dp[n+5][n+5][n+5][n+5];
    memset(dp,0,sizeof dp);

    rep(l1,n){
        rev(r1,n+1,l1+1){
            // l1 --> l1+1
            rep1(l2,n){
                for(int r2 = l2; r2 <= n; ++r2){
                    rep1(l3,l2){
                        for(int r3 = r2; r3 <= n; ++r3){
                            if(p[l1+1][r3]-p[l1+1][l3-1]) conts;
                            amax(dp[l1+1][r1][l3][r3],dp[l1][r1][l2][r2]+r3-l3+1);
                        }
                    }
                }
            }

            // r1 --> r1-1
            rep1(l2,n){
                for(int r2 = l2; r2 <= n; ++r2){
                    rep1(l3,l2){
                        for(int r3 = r2; r3 <= n; ++r3){
                            if(p[r1-1][r3]-p[r1-1][l3-1]) conts;
                            amax(dp[l1][r1-1][l3][r3],dp[l1][r1][l2][r2]+r3-l3+1);
                        }
                    }
                }
            }
        }
    }

    int ans = 0;
    rep(l1,n+1){
        int r1 = l1+1;
        rep1(l2,n){
            for(int r2 = l2; r2 <= n; ++r2){
                amax(ans,dp[l1][r1][l2][r2]);
            }
        }
    }

    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 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 604 KB ok
5 Correct 0 ms 348 KB ok
6 Correct 0 ms 348 KB ok
7 Execution timed out 4595 ms 476248 KB Time limit exceeded
8 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 1 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 1 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 0 ms 348 KB ok
12 Correct 0 ms 436 KB ok
13 Correct 1 ms 436 KB ok
# Verdict Execution time Memory Grader output
1 Correct 0 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 1 ms 348 KB ok
7 Correct 0 ms 344 KB ok
8 Correct 1 ms 348 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 0 ms 436 KB ok
14 Correct 1 ms 436 KB ok
15 Correct 1 ms 348 KB ok
16 Correct 1 ms 344 KB ok
17 Correct 1 ms 348 KB ok
18 Correct 1 ms 436 KB ok
19 Correct 1 ms 344 KB ok
20 Correct 0 ms 348 KB ok
21 Correct 0 ms 436 KB ok
22 Correct 1 ms 444 KB ok
23 Correct 1 ms 372 KB ok
24 Correct 1 ms 348 KB ok
25 Correct 0 ms 348 KB ok
26 Correct 1 ms 436 KB ok
# Verdict Execution time Memory Grader output
1 Correct 0 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 604 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 1 ms 348 KB ok
8 Correct 1 ms 348 KB ok
9 Correct 0 ms 344 KB ok
10 Correct 1 ms 348 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 0 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 0 ms 436 KB ok
16 Correct 1 ms 436 KB ok
17 Correct 1 ms 348 KB ok
18 Correct 1 ms 344 KB ok
19 Correct 1 ms 348 KB ok
20 Correct 1 ms 436 KB ok
21 Correct 1 ms 344 KB ok
22 Correct 0 ms 348 KB ok
23 Correct 0 ms 436 KB ok
24 Correct 1 ms 444 KB ok
25 Correct 1 ms 372 KB ok
26 Correct 1 ms 348 KB ok
27 Correct 0 ms 348 KB ok
28 Correct 1 ms 436 KB ok
29 Correct 0 ms 348 KB ok
30 Correct 48 ms 6080 KB ok
31 Correct 54 ms 6292 KB ok
32 Correct 49 ms 6236 KB ok
33 Correct 45 ms 6292 KB ok
34 Correct 48 ms 6292 KB ok
35 Correct 49 ms 6296 KB ok
36 Correct 51 ms 6236 KB ok
37 Correct 46 ms 6236 KB ok
38 Correct 45 ms 6236 KB ok
39 Correct 44 ms 6236 KB ok
40 Correct 53 ms 6236 KB ok
41 Correct 63 ms 6292 KB ok
# Verdict Execution time Memory Grader output
1 Correct 0 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 604 KB ok
6 Correct 1 ms 348 KB ok
7 Correct 1 ms 348 KB ok
8 Correct 1 ms 348 KB ok
9 Correct 0 ms 344 KB ok
10 Correct 1 ms 348 KB ok
11 Correct 0 ms 348 KB ok
12 Correct 0 ms 348 KB ok
13 Correct 0 ms 348 KB ok
14 Correct 0 ms 348 KB ok
15 Correct 0 ms 436 KB ok
16 Correct 1 ms 436 KB ok
17 Correct 1 ms 348 KB ok
18 Correct 1 ms 344 KB ok
19 Correct 1 ms 348 KB ok
20 Correct 1 ms 436 KB ok
21 Correct 1 ms 344 KB ok
22 Correct 0 ms 348 KB ok
23 Correct 0 ms 436 KB ok
24 Correct 1 ms 444 KB ok
25 Correct 1 ms 372 KB ok
26 Correct 1 ms 348 KB ok
27 Correct 0 ms 348 KB ok
28 Correct 1 ms 436 KB ok
29 Correct 0 ms 348 KB ok
30 Correct 48 ms 6080 KB ok
31 Correct 54 ms 6292 KB ok
32 Correct 49 ms 6236 KB ok
33 Correct 45 ms 6292 KB ok
34 Correct 48 ms 6292 KB ok
35 Correct 49 ms 6296 KB ok
36 Correct 51 ms 6236 KB ok
37 Correct 46 ms 6236 KB ok
38 Correct 45 ms 6236 KB ok
39 Correct 44 ms 6236 KB ok
40 Correct 53 ms 6236 KB ok
41 Correct 63 ms 6292 KB ok
42 Runtime error 1234 ms 2097152 KB Execution killed with signal 9
43 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 604 KB ok
6 Correct 0 ms 348 KB ok
7 Correct 0 ms 348 KB ok
8 Execution timed out 4595 ms 476248 KB Time limit exceeded
9 Halted 0 ms 0 KB -