#include "towers.h"
#include<bits/stdc++.h>
using namespace std;
int sommet;
vector<int> altitudes;
void init(int N, vector<int> H) {
altitudes = H;
int hcur = 0;
int pos = 0;
while(H[pos] > hcur){
hcur = H[pos];
pos++;
}
sommet = pos-1;
}
int max_towers(int L, int R, int D) {
if(L<=sommet && R<=sommet)
return 1;
if(L>=sommet && R>=sommet)
return 1;
if(altitudes[sommet] - max(altitudes[L], altitudes[R]) < D)
return 1;
return 2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
264 ms |
1112 KB |
Output is correct |
2 |
Correct |
617 ms |
1368 KB |
Output is correct |
3 |
Correct |
586 ms |
1368 KB |
Output is correct |
4 |
Correct |
537 ms |
1368 KB |
Output is correct |
5 |
Correct |
552 ms |
1604 KB |
Output is correct |
6 |
Correct |
566 ms |
1368 KB |
Output is correct |
7 |
Correct |
568 ms |
1364 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 |
377 ms |
1368 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
186 ms |
684 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 |
264 ms |
1112 KB |
Output is correct |
2 |
Correct |
617 ms |
1368 KB |
Output is correct |
3 |
Correct |
586 ms |
1368 KB |
Output is correct |
4 |
Correct |
537 ms |
1368 KB |
Output is correct |
5 |
Correct |
552 ms |
1604 KB |
Output is correct |
6 |
Correct |
566 ms |
1368 KB |
Output is correct |
7 |
Correct |
568 ms |
1364 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 |
- |