#include "towers.h"
#include "bits/stdc++.h"
#include <vector>
std::vector<int> act;
int maxI = 0;
void init(int N, std::vector<int> H) {
using namespace std;
act = H;
maxI = max_element(act.begin(), act.end()) - act.begin();
}
int max_towers(int L, int R, int D) {
if (maxI < L || maxI > R) return 1;
if (act[maxI] - act[L] >= D && act[maxI] - act[R] >= D )return 2;
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
265 ms |
932 KB |
Output is correct |
2 |
Correct |
504 ms |
1600 KB |
Output is correct |
3 |
Correct |
514 ms |
1600 KB |
Output is correct |
4 |
Correct |
557 ms |
1604 KB |
Output is correct |
5 |
Correct |
545 ms |
1600 KB |
Output is correct |
6 |
Correct |
515 ms |
1600 KB |
Output is correct |
7 |
Correct |
575 ms |
1604 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 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 |
420 ms |
1592 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 |
156 ms |
688 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 |
265 ms |
932 KB |
Output is correct |
2 |
Correct |
504 ms |
1600 KB |
Output is correct |
3 |
Correct |
514 ms |
1600 KB |
Output is correct |
4 |
Correct |
557 ms |
1604 KB |
Output is correct |
5 |
Correct |
545 ms |
1600 KB |
Output is correct |
6 |
Correct |
515 ms |
1600 KB |
Output is correct |
7 |
Correct |
575 ms |
1604 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 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 |
- |