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 "towers.h"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;
namespace
{
int N;
vector<int> H, s;
}
void init(int _N, vector<int> _H)
{
H = _H;
N = _N;
s.resize(N);
for (int i = 1; i + 1 < N; i++)
s[i] = (H[i - 1] < H[i] && H[i] > H[i + 1]);
for (int i = 1; i < N; i++)
s[i] += s[i - 1];
}
int max_towers(int L, int R, int D)
{
if(R - L <= 1)
return 1;
return max(1, s[R - 1] - s[L]);
}
# | 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... |