# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
799622 | I_Love_EliskaM_ | Raisins (IOI09_raisins) | C++14 | 222 ms | 82636 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define forn(i,n) for(int i=0;i<n;++i)
#define pi pair<int,int>
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
#define vii(a,n) vector<int>a(n);forn(i,n)cin>>a[i];
const int inf = 1e15;
const int N=50;
int dp[N][N][N][N];
int mem[N][N][N][N];
int pr[N+1][N+1];
int query(int a, int b, int c, int d) {
a++, b++, c++, d++;
return pr[c][d] - pr[c][b-1] - pr[a-1][d] + pr[a-1][b-1];
}
void rec(int a, int b, int c, int d) {
if (mem[a][b][c][d]) return;
mem[a][b][c][d]=1;
for (int m=a; m<c; ++m) {
rec(a,b,m,d); rec(m+1,b,c,d);
dp[a][b][c][d]=min(dp[a][b][c][d],dp[a][b][m][d]+dp[m+1][b][c][d]);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |