#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
vector<int> H;
int mid;
}
void init(int N,vector<int> H){
H.emplace(H.begin(),0);
H.emplace(H.end(),0);
::H = H;
for(int i=1;i<=N;i++)if(H[i]>H[i-1] and H[i]>H[i+1])mid=i;
}
int max_towers(int L,int R,int D){
L++;R++;
if(R<mid or mid<L)return 1;
if(max(H[L],H[R])+D<=H[mid])return 2;
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
321 ms |
1132 KB |
Output is correct |
2 |
Correct |
647 ms |
1488 KB |
Output is correct |
3 |
Correct |
612 ms |
1488 KB |
Output is correct |
4 |
Correct |
653 ms |
1488 KB |
Output is correct |
5 |
Correct |
642 ms |
1488 KB |
Output is correct |
6 |
Correct |
647 ms |
1488 KB |
Output is correct |
7 |
Correct |
711 ms |
1488 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 |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
498 ms |
1600 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
208 ms |
600 KB |
1st lines differ - on the 1st token, expected: '7197', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
321 ms |
1132 KB |
Output is correct |
2 |
Correct |
647 ms |
1488 KB |
Output is correct |
3 |
Correct |
612 ms |
1488 KB |
Output is correct |
4 |
Correct |
653 ms |
1488 KB |
Output is correct |
5 |
Correct |
642 ms |
1488 KB |
Output is correct |
6 |
Correct |
647 ms |
1488 KB |
Output is correct |
7 |
Correct |
711 ms |
1488 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 |
1 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |