# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
951389 | starchan | Dango Maker (JOI18_dango_maker) | C++17 | 249 ms | 159804 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 in pair<int, int>
#define f first
#define s second
#define pb push_back
#define pob pop_back
#define INF (int)1e17
#define fast() ios_base::sync_with_stdio(false); cin.tie(NULL)
const int SMX = 3e3+5;
char grid[SMX][SMX];
int gud[SMX][SMX][2];//automatically set to zero anyway
int solve(int DIAG, int l, int r)
{
int n = r-l+1;
int dp[n+1][2];
dp[0][0] = dp[0][1] = 0;
dp[1][0] = gud[l][DIAG-l][0]; dp[1][1] = gud[l][DIAG-l][1];
for(int i = 2; i <= n; i++)
{
dp[i][0] = gud[l-1+i][DIAG-l+1-i][0]+max(dp[i-1][0], max(dp[i-2][0], dp[i-2][1]));
dp[i][1] = gud[l-1+i][DIAG-l+1-i][1]+max(dp[i-1][1], max(dp[i-2][0], dp[i-2][1]));
}
int ans = 0;
for(int i = 0; i <= n; i++)
ans = max(ans, max(dp[i][0], dp[i][1]));
return ans;
}
signed main()
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |