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;
vector<int> height;
int N,k=0;
void init(int n,vector<int> H)
{
N=n;
height=H;
}
int max_towers(int l,int r,int d)
{
int res=1;
for (int i=l;i<=r;i++)
{
int max_height=0,how_many=1,preth=height[i];
for (int j=i+1;j<=r;j++)
{
max_height=max(max_height,height[j]);
if (max_height-height[j]>=d&&max_height-preth>=d)
{
how_many++;
preth=max(preth,height[j]);
if (preth==height[j])
max_height=0;
}
}
res=max(res,how_many);
}
return res;
}
# | 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... |