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>
#include "towers.h"
using namespace std;
int a,b,c,d,e,i,j,ii,jj,zx,xc,f[100009],jm[100009],L,R,D,F[100009];
void init(int NN, std::vector<int> HH) {
a=NN;
for(i=1; i<=a; i++) f[i]=HH[i-1];
f[0]=1000000009;f[a+1]=f[0];
for(i=1; i<=a; i++){
jm[i]=jm[i-1];
if(f[i]<f[i-1]&&f[i]<f[i+1]){
jm[i]++;F[i]=1;
}
}
}
int max_towers(int LL, int RR, int DD) {
L=LL+1;R=RR+1;D=DD;
zx=jm[R]-jm[L-1];
if(F[L]==0&&f[L]<f[L+1]) zx++;
if(L!=R&&F[R]==0&&f[R]<f[R-1]) zx++;
zx=max(zx,1);
return zx;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |