#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
int maxi = 0;
vector<int> towers;
int maxpos = -1;
void init(int N, std::vector<int> H) {
towers = H;
FOR(i,0,N){
maxi = max(maxi, H[i]);
}
FOR(i,0,N){
if (H[i] == maxi) maxpos = i;
}
}
int max_towers(int L, int R, int D) {
if (L==R) return 1;
if (maxi - towers[L] >= D && maxi - towers[R] >= D && L<=maxpos && R >= maxpos){
return 2;
}else{
return 1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
319 ms |
1112 KB |
Output is correct |
2 |
Correct |
643 ms |
1368 KB |
Output is correct |
3 |
Correct |
679 ms |
1368 KB |
Output is correct |
4 |
Correct |
627 ms |
1592 KB |
Output is correct |
5 |
Correct |
681 ms |
1368 KB |
Output is correct |
6 |
Correct |
612 ms |
1368 KB |
Output is correct |
7 |
Correct |
619 ms |
1368 KB |
Output is correct |
8 |
Correct |
1 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 |
1 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 |
1 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 |
457 ms |
1596 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 |
225 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 |
1 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 |
319 ms |
1112 KB |
Output is correct |
2 |
Correct |
643 ms |
1368 KB |
Output is correct |
3 |
Correct |
679 ms |
1368 KB |
Output is correct |
4 |
Correct |
627 ms |
1592 KB |
Output is correct |
5 |
Correct |
681 ms |
1368 KB |
Output is correct |
6 |
Correct |
612 ms |
1368 KB |
Output is correct |
7 |
Correct |
619 ms |
1368 KB |
Output is correct |
8 |
Correct |
1 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 |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |