#include "towers.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define all(x) x.begin(),x.end()
typedef long long ll;
#define pb push_back
#define INF 9999999999999999
ll k=0,n;
vector<int>h;
void init(int N, vector<int> H)
{
n=N;
for(int i=0;i<N;i++)
{
h.pb(H[i]);
if(i!=0)
{
if(H[i-1]<H[i] && H[i+1]<H[i])
k=i;
}
}
}
int max_towers(int L, int R, int D) {
if(L>=k || R<k)
return 1;
if(h[k]-D<h[L] || h[k]-D<h[R])
return 1;
else
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
269 ms |
1064 KB |
Output is correct |
2 |
Correct |
593 ms |
1700 KB |
Output is correct |
3 |
Correct |
593 ms |
1612 KB |
Output is correct |
4 |
Correct |
619 ms |
1740 KB |
Output is correct |
5 |
Correct |
576 ms |
1612 KB |
Output is correct |
6 |
Correct |
520 ms |
1740 KB |
Output is correct |
7 |
Correct |
564 ms |
1740 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
408 ms |
1696 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
188 ms |
592 KB |
1st lines differ - on the 1st token, expected: '7197', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
269 ms |
1064 KB |
Output is correct |
2 |
Correct |
593 ms |
1700 KB |
Output is correct |
3 |
Correct |
593 ms |
1612 KB |
Output is correct |
4 |
Correct |
619 ms |
1740 KB |
Output is correct |
5 |
Correct |
576 ms |
1612 KB |
Output is correct |
6 |
Correct |
520 ms |
1740 KB |
Output is correct |
7 |
Correct |
564 ms |
1740 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |