# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
147157 | jh05013 | Growing Vegetable is Fun 3 (JOI19_ho_t3) | C++17 | 219 ms | 163072 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dbgv(V) for(auto x:V)cout<<x<<' ';cout<<endl;
#define FOR(a,n) for(int a=0;a<n;a++)
void OJize(){cin.tie(NULL); ios_base::sync_with_stdio(false);}
#define ZZ 401
#define INF 999999
int dp[ZZ][ZZ][ZZ][3];
int acc[3][ZZ];
// (r,g,y) counts, last R/G/B ... +1
vector<int> R, G, Y;
void upd(int r, int g, int y, int prev, int cur){
// Where is the new vegetable?
int pos=0, nr=r, ng=g, ny=y;
if(cur == 0) pos = R[r], nr++;
else if(cur == 1) pos = G[g], ng++;
else pos = Y[y], ny++;
// How much was it pushed to the right?
int rig=0;
if(cur != 0) rig+= max(0, r-acc[0][pos]);
if(cur != 1) rig+= max(0, g-acc[1][pos]);
if(cur != 2) rig+= max(0, y-acc[2][pos]);
// Where is the desired position?
int goal = r+g+y;
int nv = dp[r][g][y][prev] + pos+rig-goal;
dp[nr][ng][ny][cur] = min(dp[nr][ng][ny][cur], nv);
}
# | 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... |