#include "towers.h"
#include <iostream>
#include <vector>
using namespace std;
int n,cent;
long long h[200005];
void init(int N, vector<int>H)
{
int n=N;
int i;
cent=0;
h[0]=0;
for(i=1;i<=n;i++)
{
h[i]=H[i-1];
if(h[i]>=h[cent])
{
cent=i;
}
}
}
int max_towers(int L,int R,int D)
{
L++;
R++;
if(L<cent && R>cent && max(h[L],h[R])+D<=h[cent])
{
return 2;
}
else
{
return 1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
367 ms |
1192 KB |
Output is correct |
2 |
Correct |
723 ms |
1828 KB |
Output is correct |
3 |
Correct |
807 ms |
1736 KB |
Output is correct |
4 |
Correct |
882 ms |
1840 KB |
Output is correct |
5 |
Correct |
677 ms |
1856 KB |
Output is correct |
6 |
Correct |
815 ms |
1832 KB |
Output is correct |
7 |
Correct |
761 ms |
1828 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
1 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 |
680 ms |
1840 KB |
1st lines differ - on the 1st token, expected: '11903', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
276 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 |
367 ms |
1192 KB |
Output is correct |
2 |
Correct |
723 ms |
1828 KB |
Output is correct |
3 |
Correct |
807 ms |
1736 KB |
Output is correct |
4 |
Correct |
882 ms |
1840 KB |
Output is correct |
5 |
Correct |
677 ms |
1856 KB |
Output is correct |
6 |
Correct |
815 ms |
1832 KB |
Output is correct |
7 |
Correct |
761 ms |
1828 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
1 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 |
- |