# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
783195 | canadavid1 | 건포도 (IOI09_raisins) | C++14 | 670 ms | 33636 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x),end(x)
using pii = pair<int,int>;
using i64 = int64_t;
using i8 = int;
vector<vector<int>> raisins;
int Y,X;
i64 memo[50*50*50*50] = {};
i64& mem(i8 sx,i8 sy,i8 ex, i8 ey)
{
return memo[sx*50*50*50+sy*50*50+ex*50+ey];
}
i64 min_cost(i8 sx,i8 sy,i8 ex,i8 ey)
{
// memoize
if(ey-sy <= 1 && ex - sx <= 1)
{
return 0;
}
if (mem(sx,sy,ex,ey)!=0) return mem(sx,sy,ex,ey);
// rows
int cost = /* count of raisins present */ 0;
for(int i = sy; i < ey; i++) for(int j = sx; j < ex; j++) cost += raisins[i][j];
i64 mincost = INT64_MAX;
for(int i = sx+1; i < ex;i++)
{
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |