Submission #938430

#TimeUsernameProblemLanguageResultExecution timeMemory
938430GrindMachineSoccer Stadium (IOI23_soccer)C++17
48 / 100
4595 ms2097152 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...