#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
int valley[100100],pos;
vector<int>H;
void init(int N, std::vector<int> H_) {
H=H_;
pos=max_element(H.begin(),H.end())-H.begin();
}
int dp[100100];
int max_towers(int l, int r, int D) {
if(l>=pos||r<=pos) return 1;
return 1+(max(H[l],H[r])+D<=H[pos]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
241 ms |
1108 KB |
Output is correct |
2 |
Correct |
559 ms |
1624 KB |
Output is correct |
3 |
Correct |
557 ms |
1624 KB |
Output is correct |
4 |
Correct |
523 ms |
1624 KB |
Output is correct |
5 |
Correct |
473 ms |
1624 KB |
Output is correct |
6 |
Correct |
491 ms |
1624 KB |
Output is correct |
7 |
Correct |
513 ms |
1624 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 |
1 ms |
340 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 |
1 ms |
340 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 |
339 ms |
1368 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 |
144 ms |
708 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 |
1 ms |
340 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 |
241 ms |
1108 KB |
Output is correct |
2 |
Correct |
559 ms |
1624 KB |
Output is correct |
3 |
Correct |
557 ms |
1624 KB |
Output is correct |
4 |
Correct |
523 ms |
1624 KB |
Output is correct |
5 |
Correct |
473 ms |
1624 KB |
Output is correct |
6 |
Correct |
491 ms |
1624 KB |
Output is correct |
7 |
Correct |
513 ms |
1624 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 |
1 ms |
340 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |