#include "towers.h"
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 3;
int p = 0;
int a[MAXN];
int n;
void init(int N, vector<int> H) {
n = N;
int mx = 0;
for (int i = 0; i < N; i++){
if (H[i] > mx) mx = H[i], p = i;
a[i] = H[i];
}
return;
}
int max_towers(int L, int R, int D) {
if (p != 0 && p != n-1 && L <= p && p <= R && a[L] <= a[p]-D && a[R] <= a[p]-D){
return 2;
}
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
222 ms |
948 KB |
Output is correct |
2 |
Correct |
510 ms |
1608 KB |
Output is correct |
3 |
Correct |
511 ms |
1608 KB |
Output is correct |
4 |
Correct |
494 ms |
1612 KB |
Output is correct |
5 |
Correct |
513 ms |
1604 KB |
Output is correct |
6 |
Correct |
517 ms |
1368 KB |
Output is correct |
7 |
Correct |
505 ms |
1616 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 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 |
344 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 |
388 ms |
1604 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 |
175 ms |
720 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 |
344 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 |
222 ms |
948 KB |
Output is correct |
2 |
Correct |
510 ms |
1608 KB |
Output is correct |
3 |
Correct |
511 ms |
1608 KB |
Output is correct |
4 |
Correct |
494 ms |
1612 KB |
Output is correct |
5 |
Correct |
513 ms |
1604 KB |
Output is correct |
6 |
Correct |
517 ms |
1368 KB |
Output is correct |
7 |
Correct |
505 ms |
1616 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 ms |
344 KB |
Output is correct |
11 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |