Submission #937625

# Submission time Handle Problem Language Result Execution time Memory
937625 2024-03-04T09:46:57 Z Wansur Soccer Stadium (IOI23_soccer) C++17
0 / 100
1 ms 344 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 len = 1; len < n; len++) {
        for (int i = 0; i + len - 1 < n; i++) {
            int j = i + len - 1;
            for (int len = n; len; len--) {
                for (int l = 0; l + len - 1 < n; l++) {
                    int r = l + len - 1;
                    if (l > 0) dp[i][j][l][r] = max(dp[i][j][l - 1][r], dp[i][j][l][r]);
                    if (r < n - 1) dp[i][j][l][r] = max(dp[i][j][l][r - 1], dp[i][j][l][r]);
                }
            }
            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)) {
                        dp[i][j][l][r] = -1e9;
                        continue;
                    }
                    dp[i][j][l][r] += r - l + 1;
                    ans=max(ans, dp[i][j][l][r]);
                    if (i) dp[i - 1][j][l][r] = max(dp[i - 1][j][l][r], dp[i][j][l][r]);
                    if (j < n - 1) dp[i][j+1][l][r] = max(dp[i][j+1][l][r], dp[i][j][l][r]);
                }
            }
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB ok
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB wrong
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB ok
2 Incorrect 0 ms 344 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB ok
2 Incorrect 0 ms 344 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB ok
2 Incorrect 0 ms 344 KB wrong
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB ok
2 Incorrect 0 ms 344 KB wrong
3 Halted 0 ms 0 KB -