# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
629570 | arnold518 | 메기 농장 (IOI22_fish) | C++17 | 88 ms | 13988 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 3000;
const ll INF = 1e18;
int N, M;
vector<pii> V[MAXN+10];
ll dp1[MAXN+10][MAXN+10], dp2[MAXN+10][MAXN+10], P[MAXN+10];
ll max_weights(int _N, int _M, vector<int> _X, vector<int> _Y, vector<int> _W)
{
N=_N; M=_M;
ll ret=0;
for(int i=0; i<M; i++)
{
//V[_X[i]+1].push_back({_Y[i]+1, _W[i]});
ret+=_W[i];
}
return ret;
for(int i=1; i<=N; i++)
{
sort(V[i].begin(), V[i].end());
}
for(int i=0; i<=N; i++) for(int j=0; j<=N; j++) dp1[i][j]=dp2[i][j]=-INF;
for(int i=0; i<=N; i++) dp2[0][i]=0;
dp1[0][0]=0; dp2[0][0]=0;
for(int i=1; i<=N+1; i++)
{
int t=V[i].size()-1;
P[N]=dp1[i-1][N];
for(int j=N-1; j>=0; j--)
{
int tt=0;
if(t>=0 && V[i][t].first==j+1) tt=V[i][t--].second;
P[j]=max(P[j+1]+tt, dp1[i-1][j]);
}
for(int j=0; j<=N; j++) dp1[i][j]=max(dp2[i-1][j], P[j]);
ll p=0, q=0;
t=0;
for(int j=0; j<=N; j++)
{
int tt=0;
if(t<V[i].size() && V[i][t].first==j) tt=V[i][t++].second;
p=max(p, dp1[i-1][j]); q+=tt;
P[j]=max(P[j], p)+q;
}
for(int j=0; j<=N; j++) dp2[i][j]=max(dp2[i][j], P[j]);
t=0; P[0]=0;
for(int j=1; j<=N; j++)
{
int tt=0;
if(t<V[i].size() && V[i][t].first==j) tt=V[i][t++].second;
P[j]=max(P[j-1]+tt, dp2[i-1][j]);
}
for(int j=0; j<=N; j++) dp2[i][j]=max(dp2[i][j], P[j]);
}
for(int i=1; i<=N; i++)
{
for(int j=0; j<=N; j++) printf("%lld ", dp1[i][j]); printf("\n");
}
printf("\n");
for(int i=1; i<=N; i++)
{
for(int j=0; j<=N; j++) printf("%lld ", dp2[i][j]); printf("\n");
}
return max(dp1[N+1][0], dp2[N+1][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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |