#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
int id;
vector<int> a;
void init(int N, std::vector<int> H) {
a = H;
id = N - 1;
for (int i = 0; i < N - 1; ++i) {
if (H[i] > H[i + 1] && (i == 0 || H[i] > H[i - 1])) id = i;
}
}
int max_towers(int L, int R, int D) {
if (L < id && R > id) {
int mn1 = a[L], mn2 = a[R];
return (mn1 <= a[id] - D && mn2 <= a[id] - D ? 2 : 1);
}
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
280 ms |
924 KB |
Output is correct |
2 |
Correct |
543 ms |
1436 KB |
Output is correct |
3 |
Correct |
466 ms |
1448 KB |
Output is correct |
4 |
Correct |
697 ms |
1360 KB |
Output is correct |
5 |
Correct |
560 ms |
1444 KB |
Output is correct |
6 |
Correct |
575 ms |
1424 KB |
Output is correct |
7 |
Correct |
700 ms |
1464 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 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 |
349 ms |
1432 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
185 ms |
464 KB |
1st lines differ - on the 1st token, expected: '7197', found: '2' |
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 |
280 ms |
924 KB |
Output is correct |
2 |
Correct |
543 ms |
1436 KB |
Output is correct |
3 |
Correct |
466 ms |
1448 KB |
Output is correct |
4 |
Correct |
697 ms |
1360 KB |
Output is correct |
5 |
Correct |
560 ms |
1444 KB |
Output is correct |
6 |
Correct |
575 ms |
1424 KB |
Output is correct |
7 |
Correct |
700 ms |
1464 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 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 |
- |