# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1008341 | Amr | 축구 경기장 (IOI23_soccer) | C++17 | 2 ms | 1628 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "soccer.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using namespace std;
#define F first
#define S second
#define sz size()
#define all(x) (x).begin(), (x).end()
const int N = 32;
ll n;
vector<vector<int> > a;
ll dp[N][N][N][2];
ll pre[N][N];
int biggest_stadium(int N, std::vector<std::vector<int>> F)
{
n = N, a = F;
for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) pre[i][j] = pre[i][j-1]+a[i-1][j-1];
//for(int i = 1; i <= n; i++) {for(int j = 1; j <= n;j++) cout << pre[i][j] << " "; cout << endl;}
// base case
ll best = 0;
for(int u = 1; u <= n; u++) for(int v = u; v <= n; v++){
for(int r = 1; r <= n ;r++) for(int i = 1; i <= n; i++) for(int j = 1; j <= n ;j++) dp[r][i][j][0] = dp[r][i][j][2] = 0;
for(int r = 1; r <= n; r++)
for(int i = 1; i <= n; i++) for(int j = i; j <= n ;j++)
{
if(i>u||j<v) continue;
ll cnt = pre[r][j]-pre[r][i-1];
if(cnt>0) continue;
dp[r][i][j][0] = j-i+1;
dp[r][i][j][1] = j-i+1;
// cout << dp[1][i][j][0] << " ";
}
for(int r = 2; r<= n; r++)
for(int i2 = 1; i2 <= n; i2++)
{
for(int j2 = i2; j2 <= n; j2++)
{
if(i2>u||j2<v) continue;
ll cnt = pre[r-1][j2]-pre[r-1][i2-1];
if(cnt>0) continue;
for(int i = 1; i <= n; i++)
{
for(int j =i ; j <= n; j++)
{
if(i>u||j<v) continue;
cnt = pre[r][j]-pre[r][i-1];
if(cnt>0) continue;
// if(i==2&&j==5&&r==2&&i2==1&&j2==5) cout << dp[r-1][i2][j2][0] << endl;
if(i2>=i&&j2<=j) // prev is sub from me
{dp[r][i][j][0] = max(dp[r][i][j][0],dp[r-1][i2][j2][0]+j-i+1);
dp[r][i][j][1] = max(dp[r][i][j][1],dp[r-1][i2][j2][0]+j-i+1);
}
if(i2<=i&&j2>=j)
dp[r][i][j][1] = max({dp[r][i][j][1],dp[r-1][i2][j2][0]+j-i+1,dp[r-1][i2][j2][1]+j-i+1});
}
}
}
}
// cout << dp[2][3][4][1] << endl;
for(int r = 1; r <= n; r++)
for(int i = 1; i <= n; i++)
{
for(int j = i; j <= n; j++)
{
if(i>u||j<v) continue;
best = max({best,dp[r][i][j][0],dp[r][i][j][1]});
}
//if(dp[r][i][j][1]==21) cout<<r << i << " " << j << endl;
}
}
return best;
}
/*
5
0 0 0 0 0
1 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
*/
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |