Submission #370189

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3701892021-02-23 14:44:15stoyan_malininBuilding 4 (JOI20_building4)C++14
0 / 100
2075 ms8428 KiB
#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;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

building4.cpp: In function 'int main()':
building4.cpp:148:18: warning: variable 'found' set but not used [-Wunused-but-set-variable]
  148 |             bool found = false;
      |                  ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...