#include "towers.h"
#include<bits/stdc++.h>
using namespace std;
int sommet,avant;
vector<int> altitudes;
void init(int N,vector<int> H) {
altitudes.push_back(H[0]);
avant=-1;
for (int i=1;i<N;i++){
if (H[i]<H[i-1] and avant==-1){
sommet=i-1;
avant=0;
}
altitudes.push_back(H[i]);
}
}
int max_towers(int L, int R, int D) {
if (L<sommet and R>sommet and altitudes[sommet]-max(altitudes[L],altitudes[R])>=D){
return 2;
}
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
285 ms |
1236 KB |
Output is correct |
2 |
Correct |
523 ms |
1748 KB |
Output is correct |
3 |
Correct |
590 ms |
1748 KB |
Output is correct |
4 |
Correct |
579 ms |
1748 KB |
Output is correct |
5 |
Correct |
652 ms |
1748 KB |
Output is correct |
6 |
Correct |
540 ms |
1748 KB |
Output is correct |
7 |
Correct |
547 ms |
1748 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 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 |
468 ms |
1748 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
156 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 |
285 ms |
1236 KB |
Output is correct |
2 |
Correct |
523 ms |
1748 KB |
Output is correct |
3 |
Correct |
590 ms |
1748 KB |
Output is correct |
4 |
Correct |
579 ms |
1748 KB |
Output is correct |
5 |
Correct |
652 ms |
1748 KB |
Output is correct |
6 |
Correct |
540 ms |
1748 KB |
Output is correct |
7 |
Correct |
547 ms |
1748 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
1 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 |
- |