#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
int mxPos = -1;
int mx = -1;
vector<int> h;
void init(int N, std::vector<int> H) {
for (int i=0;i<N;i++) {
if (H[i] > mx) {
mx = H[i];
mxPos = i;
}
}
h = H;
}
int max_towers(int L, int R, int D) {
if (L >= mxPos || R <= mxPos) return 1;
if (mx - D < max(h[L], h[R])) return 1;
return 2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
298 ms |
1112 KB |
Output is correct |
2 |
Correct |
730 ms |
1368 KB |
Output is correct |
3 |
Correct |
560 ms |
1368 KB |
Output is correct |
4 |
Correct |
645 ms |
1368 KB |
Output is correct |
5 |
Correct |
625 ms |
1368 KB |
Output is correct |
6 |
Correct |
585 ms |
1368 KB |
Output is correct |
7 |
Correct |
650 ms |
1368 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 |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
432 ms |
1368 KB |
1st lines differ - on the 1st token, expected: '11903', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
205 ms |
688 KB |
1st lines differ - on the 1st token, expected: '7197', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
298 ms |
1112 KB |
Output is correct |
2 |
Correct |
730 ms |
1368 KB |
Output is correct |
3 |
Correct |
560 ms |
1368 KB |
Output is correct |
4 |
Correct |
645 ms |
1368 KB |
Output is correct |
5 |
Correct |
625 ms |
1368 KB |
Output is correct |
6 |
Correct |
585 ms |
1368 KB |
Output is correct |
7 |
Correct |
650 ms |
1368 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 |
- |