#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
int k=INT_MAX, n;
vector<int> h;
void init(int tempn, vector<int> temph) {
n=tempn;
h=temph;
for (int i = 1; i < n; ++i)
{
if (temph[i]>temph[i+1])
{
k=i;
return;
}
}
return;
}
int max_towers(int L, int R, int D) {
if (k<L || k>R || h[k]-D<max(h[L], h[R])) return 1;
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
451 ms |
976 KB |
Output is correct |
2 |
Correct |
888 ms |
1352 KB |
Output is correct |
3 |
Correct |
801 ms |
1436 KB |
Output is correct |
4 |
Correct |
798 ms |
1352 KB |
Output is correct |
5 |
Correct |
600 ms |
1440 KB |
Output is correct |
6 |
Correct |
820 ms |
1428 KB |
Output is correct |
7 |
Correct |
580 ms |
1480 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
296 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 |
496 ms |
1436 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 |
173 ms |
556 KB |
1st lines differ - on the 1st token, expected: '7197', 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 |
Correct |
451 ms |
976 KB |
Output is correct |
2 |
Correct |
888 ms |
1352 KB |
Output is correct |
3 |
Correct |
801 ms |
1436 KB |
Output is correct |
4 |
Correct |
798 ms |
1352 KB |
Output is correct |
5 |
Correct |
600 ms |
1440 KB |
Output is correct |
6 |
Correct |
820 ms |
1428 KB |
Output is correct |
7 |
Correct |
580 ms |
1480 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
296 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 |
- |