#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
const int nx=2e3+5;
int n, qs[nx];
vector<int> h;
void init(int N, std::vector<int> H) {
n=N;
h=H;
for (int i=1; i<N-1; i++) if (h[i]<h[i-1]&&h[i]<h[i+1]) qs[i]++;
for (int i=1; i<N; i++) qs[i]+=qs[i-1];
}
int max_towers(int L, int R, int D) {
if (L==R) return 1;
return qs[R-1]-qs[L]+(h[L]<h[L+1])+(h[R]<h[R-1]);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
10 ms |
1964 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '16' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '16' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
10 ms |
2884 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
4 ms |
1036 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '16' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
10 ms |
1964 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |