#include "towers.h"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define F first
#define S second
using namespace std;
namespace
{
int N, k = 0, ono = 0;
vector<int> H;
void init()
{
while(k + 1 < N && H[k] < H[k + 1])
k++;
if(k == 0 || k == N - 1)
ono = 1;
}
}
void init(int _N, vector<int> _H) {
N = _N;
H = _H;
init();
}
int max_towers(int L, int R, int D) {
if(R <= k || k <= L || ono)
return 1;
else if(H[L] <= H[k] - D && H[R] <= H[k] - D)
return 2;
return 1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
306 ms |
976 KB |
Output is correct |
2 |
Correct |
496 ms |
1452 KB |
Output is correct |
3 |
Correct |
502 ms |
1360 KB |
Output is correct |
4 |
Correct |
570 ms |
1440 KB |
Output is correct |
5 |
Correct |
469 ms |
1460 KB |
Output is correct |
6 |
Correct |
542 ms |
1440 KB |
Output is correct |
7 |
Correct |
498 ms |
1360 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
417 ms |
1440 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
208 ms |
556 KB |
1st lines differ - on the 1st token, expected: '7197', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
306 ms |
976 KB |
Output is correct |
2 |
Correct |
496 ms |
1452 KB |
Output is correct |
3 |
Correct |
502 ms |
1360 KB |
Output is correct |
4 |
Correct |
570 ms |
1440 KB |
Output is correct |
5 |
Correct |
469 ms |
1460 KB |
Output is correct |
6 |
Correct |
542 ms |
1440 KB |
Output is correct |
7 |
Correct |
498 ms |
1360 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |