#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
#include "towers.h"
int N;
vi H;
int maxv = -1;
int maxp = -1;
void init(int N_g, vi H_g) {
N = N_g;
H = H_g;
for (int i = 0; i < N; i++) {
if (H[i] > maxv) {
maxv = H[i];
maxp = i;
}
}
}
int max_towers(int L, int R, int D) {
if (L <= maxp && maxp <= R) {
if (H[L] <= maxv - D && H[R] <= maxv - D)
return 2;
return 1;
}
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
256 ms |
1112 KB |
Output is correct |
2 |
Correct |
501 ms |
1368 KB |
Output is correct |
3 |
Correct |
514 ms |
1368 KB |
Output is correct |
4 |
Correct |
507 ms |
1368 KB |
Output is correct |
5 |
Correct |
521 ms |
1368 KB |
Output is correct |
6 |
Correct |
451 ms |
1368 KB |
Output is correct |
7 |
Correct |
510 ms |
1368 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 |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
383 ms |
1368 KB |
1st lines differ - on the 1st token, expected: '11903', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
158 ms |
684 KB |
1st lines differ - on the 1st token, expected: '7197', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
256 ms |
1112 KB |
Output is correct |
2 |
Correct |
501 ms |
1368 KB |
Output is correct |
3 |
Correct |
514 ms |
1368 KB |
Output is correct |
4 |
Correct |
507 ms |
1368 KB |
Output is correct |
5 |
Correct |
521 ms |
1368 KB |
Output is correct |
6 |
Correct |
451 ms |
1368 KB |
Output is correct |
7 |
Correct |
510 ms |
1368 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 |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |