#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
const int LOG = 18;
int n;
int k;
vector<int> h;
vector<int> pref;
void init(int N_, vector<int> H_) {
n = N_, h = H_;
for (int i = 1; i < n; ++i) {
if (h[i] > h[i - 1] && h[i] > h[i + 1]) {
k = i;
break;
}
}
}
int max_towers(int l, int r, int d) {
if (l >= k || r <= k) {
return 1;
}
return max(h[l], h[r]) + d <= h[k] ? 2 : 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
268 ms |
1112 KB |
Output is correct |
2 |
Correct |
561 ms |
1368 KB |
Output is correct |
3 |
Correct |
555 ms |
1368 KB |
Output is correct |
4 |
Correct |
547 ms |
1368 KB |
Output is correct |
5 |
Correct |
587 ms |
1368 KB |
Output is correct |
6 |
Correct |
604 ms |
1368 KB |
Output is correct |
7 |
Correct |
600 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 |
446 ms |
1368 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
173 ms |
600 KB |
1st lines differ - on the 1st token, expected: '7197', 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 |
Correct |
268 ms |
1112 KB |
Output is correct |
2 |
Correct |
561 ms |
1368 KB |
Output is correct |
3 |
Correct |
555 ms |
1368 KB |
Output is correct |
4 |
Correct |
547 ms |
1368 KB |
Output is correct |
5 |
Correct |
587 ms |
1368 KB |
Output is correct |
6 |
Correct |
604 ms |
1368 KB |
Output is correct |
7 |
Correct |
600 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 |
- |