# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
9711 | shashack | On grid (kriii2_O) | C++98 | 1000 ms | 3340 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 <cstdio>
#include <algorithm>
using namespace std;
typedef long long ll;
int row, col;
const ll INF=9876543210000;
ll data[310][310], psum[310][310], cache[310][310];
ll get_psum(int sx, int sy, int ex, int ey)
{
ll ret = psum[ex][ey] - psum[sx-1][ey] - psum[ex][sy-1] + psum[sx-1][sy-1];
return ret;
}
ll solution(int x, int y)
{
if(x==row+1 && y==col+1) return 0;
else if(x==row+1 || y==col+1) return -INF;
ll& ret=cache[x][y];
if(ret!=-INF) return ret;
for(int i=x ; i<=row ; i++)
for(int j=y ; j<=col ; j++)
ret=max(ret, solution(i+1, j+1)+get_psum(x, y, i, j));
return ret;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |