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;
long long a[100069],ps[100069];
void init(int n,vector<int> aa)
{
long long i;
for(i=1;i<=n;i++)
{
a[i]=aa[i-1];
}
for(i=1;i<=n;i++)
{
ps[i]=ps[i-1]+(i>1&&i<n&&a[i]<a[i-1]&&a[i]<a[i+1]);
}
}
int max_towers(int lb,int rb,int cw)
{
lb++;
rb++;
if(lb==rb)
{
return 1;
}
else
{
return ps[rb-1]-ps[lb]+(a[lb]<a[lb+1])+(a[rb]<a[rb-1]);
}
}
# | 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... |