답안 #937643

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
937643 2024-03-04T10:05:04 Z Wansur 축구 경기장 (IOI23_soccer) C++17
0 / 100
2 ms 8536 KB
#include <bits/stdc++.h>
#define f first
#define s second
#define ent '\n'

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")

typedef long long ll;
using namespace std;
struct seg{
    int m1,m2,sum,cnt;
};

const string out[2]={"NO\n","YES\n"};

const ll dx[]={0,1,0,-1,-1,1,1,-1};
const ll dy[]={1,0,-1,0,-1,1,-1,1};
const int mod=998244353;
const int md=1e9+7;
const int mx=2e3+12;
const bool T=0;

int dp[61][61][61][61];
int pref[61][61];
int n;

int get(int i,int l,int r){
    if(!l)return pref[i][r];
    return pref[i][r]-pref[i][l-1];
}

int biggest_stadium(int N, vector<vector<int>> a) {
    n = N;
    if (n > 30) {
        return 0;
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            pref[i][j] = a[i][j];
            if (j)pref[i][j] += pref[i][j - 1];
        }
    }
    int ans=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            for(int l=0;l<n;l++){
                for(int r=0;r<n;r++){
                    dp[i][j][l][r]=-1e9;
                }
            }
        }
    }
    for(int i=0;i<n;i++){
        for(int l=0;l<n;l++){
            for(int r=l;r<n;r++){
                if(a[i][r])break;
                dp[i][i][l][r]=r-l+1;
            }
        }
    }
    for(int len=2;len<=n;len++){
        for(int i=0;i+len-1<=n;i++){
            int j=i+len-1;
            for(int len=1;len<=n;len++){
                for(int l=0;l+len-1<=n;l++){
                    int r=l+len-1;
                    if(!get(i,l,r)){
                        for(int tl=l;tl>=0;tl--){
                            for(int tr=r;tr<n;tr++){
                                dp[i][j][l][r]=max(dp[i][j][l][r], dp[i+1][j][tl][tr] + r-l+1);
                            }
                        }
                    }
                    if(!get(j,l,r)){
                        for(int tl=l;tl>=0;tl--){
                            for(int tr=r;tr<n;tr++){
                                dp[i][j][l][r]=max(dp[i][j][l][r], dp[i][j-1][tl][tr] + r-l+1);
                            }
                        }
                    }
                    ans=max(ans,dp[i][j][l][r]);
                }
            }
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB ok
2 Correct 2 ms 2396 KB ok
3 Incorrect 1 ms 8536 KB wrong
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB ok
2 Correct 2 ms 2396 KB ok
3 Correct 1 ms 2392 KB ok
4 Correct 1 ms 2392 KB ok
5 Correct 1 ms 2392 KB ok
6 Incorrect 1 ms 2396 KB wrong
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB ok
2 Correct 1 ms 2396 KB ok
3 Correct 2 ms 2396 KB ok
4 Correct 1 ms 2392 KB ok
5 Correct 1 ms 2392 KB ok
6 Correct 1 ms 2392 KB ok
7 Incorrect 1 ms 2396 KB wrong
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB ok
2 Correct 1 ms 2396 KB ok
3 Correct 2 ms 2396 KB ok
4 Incorrect 1 ms 8536 KB wrong
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB ok
2 Correct 1 ms 2396 KB ok
3 Correct 2 ms 2396 KB ok
4 Incorrect 1 ms 8536 KB wrong
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4440 KB ok
2 Correct 1 ms 2396 KB ok
3 Correct 2 ms 2396 KB ok
4 Incorrect 1 ms 8536 KB wrong
5 Halted 0 ms 0 KB -