# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370189 | stoyan_malinin | Building 4 (JOI20_building4) | C++14 | 2075 ms | 8428 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 <functional>
#include <iostream>
#include <cstring>
#include <vector>
using namespace std;
const int MAXN = 1e6 + 5;
int n;
int a[MAXN][2];
namespace MaxA
{
int memo[MAXN][2];
int rec(int ind, int lastChoice)
{
if(ind==n) return 0;
int ans = -MAXN;
int lastVal = ((ind==0)?-1:a[ind-1][lastChoice]);
for(int c = 0;c<2;c++)
{
if(lastVal<=a[ind][c])
ans = max(ans, (c==0) + rec(ind+1, c));
}
return ans;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |