Submission #885223

# Submission time Handle Problem Language Result Execution time Memory
885223 2023-12-09T10:01:29 Z heavylightdecomp Soccer Stadium (IOI23_soccer) C++17
0 / 100
1 ms 4952 KB
#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
#define vt vector
#define FOR(i,a,b) for(int i = a; i <= b; i++)
#define FORD(i,a,b) for(int i = b; i >= a; i--) 
int area[33][33][33][33];
vt<vt<int>> F;
int N;
bool check_range(int a, int l, int r) {
    FOR(i,l,r) { 
        if(F[a][i] == 1) {
            return false;
        }
    }
    return true;

}
void dp(int top, int bot, int l, int r) {
    if(bot+1 < N and check_range(bot+1, l,r)) area[top][bot+1][l][r] = max(area[top][bot+1][l][r], area[top][bot][l][r] + r-l+1);
    if(top-1 >= 0 and check_range(top-1, l, r)) area[top-1][bot][l][r] = max(area[top-1][bot][l][r], area[top][bot][l][r] + r-l+1);
    area[top][bot][l+1][r] = max(area[top][bot][l+1][r], area[top][bot][l][r]-1);
    area[top][bot][l][r-1] = max(area[top][bot][l+1][r], area[top][bot][l][r]-1);    
}
int biggest_stadium(int eN, std::vector<std::vector<int>> eF)
{
    FOR(i,0,32) FOR(j,0,32) FOR(k,0,32) FOR(l,0,32) { area[i][j][k][l] = -1; }
    F = eF;
    N = eN;
    int res = 0;
    FOR(d,0,N-1) FOR(a,0,N-1) FOR(l,0,N-1) FOR(r,0,N-1) {
        if(a+d >= N) continue;
        if(l > r) continue;
        res = max(res, area[a][a+d][l][r]);
        if(d == 0) {
            if(check_range(a,l,r)) {
                dp(a, a+d, l, r);
            }
        } else {
            dp(a,a+d,l,r);
        }
    }
    return res;
}
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 4952 KB partial
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4952 KB wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4952 KB wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 4952 KB partial
2 Incorrect 1 ms 4952 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 4952 KB partial
2 Incorrect 1 ms 4952 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 4952 KB partial
2 Incorrect 1 ms 4952 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Partially correct 1 ms 4952 KB partial
2 Incorrect 1 ms 4952 KB wrong
3 Halted 0 ms 0 KB -