#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
int k;
vector <int> a;
void init(int N, vector<int> H) {
k = -1;
for (int i = 0; i < N; i++){
bool good = true;
if (i != 0) good &= H[i] > H[i - 1];
if (i != N - 1) good &= H[i] > H[i + 1];
if (good) k = i;
}
a = H;
assert(k != -1);
}
int max_towers(int L, int R, int D) {
if (L < k && R > k) {
if (a[L] <= a[k] - D && a[R] <= a[k] - D) return 2;
else return 1;
}
else return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
367 ms |
976 KB |
Output is correct |
2 |
Correct |
609 ms |
1436 KB |
Output is correct |
3 |
Correct |
594 ms |
1444 KB |
Output is correct |
4 |
Correct |
674 ms |
1440 KB |
Output is correct |
5 |
Correct |
741 ms |
1360 KB |
Output is correct |
6 |
Correct |
559 ms |
1436 KB |
Output is correct |
7 |
Correct |
655 ms |
1432 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
372 ms |
1444 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
258 ms |
556 KB |
1st lines differ - on the 1st token, expected: '7197', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
367 ms |
976 KB |
Output is correct |
2 |
Correct |
609 ms |
1436 KB |
Output is correct |
3 |
Correct |
594 ms |
1444 KB |
Output is correct |
4 |
Correct |
674 ms |
1440 KB |
Output is correct |
5 |
Correct |
741 ms |
1360 KB |
Output is correct |
6 |
Correct |
559 ms |
1436 KB |
Output is correct |
7 |
Correct |
655 ms |
1432 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |