#include "towers.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int mxn = 1e5+10;
int mx;
int N;
vector<int> H;
void init(int NN, std::vector<int> HH) {
H = HH;
N = NN;
mx = max_element(H.begin(),H.end())-H.begin();
return;
}
int max_towers(int L, int R, int D) {
if(L>=mx||mx>=R)return 1;
else if(min(H[mx]-H[L],H[mx]-H[R])<D)return 1;
else return 2;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
248 ms |
1112 KB |
Output is correct |
2 |
Correct |
496 ms |
1368 KB |
Output is correct |
3 |
Correct |
603 ms |
1604 KB |
Output is correct |
4 |
Correct |
624 ms |
1600 KB |
Output is correct |
5 |
Correct |
579 ms |
1368 KB |
Output is correct |
6 |
Correct |
625 ms |
1368 KB |
Output is correct |
7 |
Correct |
510 ms |
1364 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 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 |
472 ms |
1596 KB |
1st lines differ - on the 1st token, expected: '11903', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
202 ms |
684 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 |
248 ms |
1112 KB |
Output is correct |
2 |
Correct |
496 ms |
1368 KB |
Output is correct |
3 |
Correct |
603 ms |
1604 KB |
Output is correct |
4 |
Correct |
624 ms |
1600 KB |
Output is correct |
5 |
Correct |
579 ms |
1368 KB |
Output is correct |
6 |
Correct |
625 ms |
1368 KB |
Output is correct |
7 |
Correct |
510 ms |
1364 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 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 |
- |