| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 17308 | gs14004 | 스카이라인 (IZhO11_skyline) | C++14 | 208 ms | 53560 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <deque>
#include <utility>
#include <bitset>
#include <iostream>
using namespace std;
typedef long long lint;
typedef long double llf;
typedef pair<int, int> pi;
int a[305], n;
int dp[305][205][205];
int f(int pos, int t1, int t2){
	if(t1 < 0 || t2 < 0) return 1e9;
	if(pos == n) return 0;
	if(~dp[pos][t1][t2]) return dp[pos][t1][t2];
	int ret = min(f(pos, t1 - 1, t2) + 3, f(pos, t1 - 1, t2 - 1) + 5);
	ret = min(ret, f(pos+1, t2-t1, a[pos+2] - t1) + t1 * 7);
	return dp[pos][t1][t2] = ret;
}
int main(){
	scanf("%d",&n);
	memset(dp,-1,sizeof(dp));
	for(int i=0; i<n; i++){
		scanf("%d",&a[i]);
	}
	printf("%d",f(0, a[0], a[1]));
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
