#include "towers.h"
#include <vector>
using namespace std;
int n,mid;
vector<int> h;
void init(int N, std::vector<int> H) {
n=N;
h=H;
mid=-1;
for(int i=0;i<n;++i) {
if((i?h[i-1]:0)<h[i] && h[i]>(i+1<n?h[i+1]:0)) {
mid=i;
if(i>0) break;
}
}
}
int max_towers(int L, int R, int D) {
if(L<=mid && mid<=R) {
if(h[L]+D<=h[mid] && h[R]+D<=h[mid]) return 2;
}
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
366 ms |
912 KB |
Output is correct |
2 |
Correct |
611 ms |
1448 KB |
Output is correct |
3 |
Correct |
955 ms |
1452 KB |
Output is correct |
4 |
Correct |
1085 ms |
1428 KB |
Output is correct |
5 |
Correct |
870 ms |
1456 KB |
Output is correct |
6 |
Correct |
1010 ms |
1444 KB |
Output is correct |
7 |
Correct |
907 ms |
1428 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
623 ms |
1436 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
333 ms |
544 KB |
1st lines differ - on the 1st token, expected: '7197', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
366 ms |
912 KB |
Output is correct |
2 |
Correct |
611 ms |
1448 KB |
Output is correct |
3 |
Correct |
955 ms |
1452 KB |
Output is correct |
4 |
Correct |
1085 ms |
1428 KB |
Output is correct |
5 |
Correct |
870 ms |
1456 KB |
Output is correct |
6 |
Correct |
1010 ms |
1444 KB |
Output is correct |
7 |
Correct |
907 ms |
1428 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |