#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef pair<ll, ll> pll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define ms memset
#define pb push_back
#define fi first
#define se second
int k, n; vi h;
void init(int N, vi H) {
n=N; h=H;
FOR(i,1,n-1){
if (H[i]>max(H[i-1],H[i+1])) k=i;
}
}
int max_towers(int L, int R, int D) {
if (L>=k || R<=k) return 1;
if (max(h[L],h[R]) > h[k]-D) return 1;
return 2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
230 ms |
936 KB |
Output is correct |
2 |
Correct |
660 ms |
1352 KB |
Output is correct |
3 |
Correct |
631 ms |
1424 KB |
Output is correct |
4 |
Correct |
617 ms |
1352 KB |
Output is correct |
5 |
Correct |
656 ms |
1444 KB |
Output is correct |
6 |
Correct |
561 ms |
1460 KB |
Output is correct |
7 |
Correct |
748 ms |
1452 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 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 |
1 ms |
208 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 |
659 ms |
1440 KB |
1st lines differ - on the 1st token, expected: '11903', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
181 ms |
556 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 |
1 ms |
208 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 |
230 ms |
936 KB |
Output is correct |
2 |
Correct |
660 ms |
1352 KB |
Output is correct |
3 |
Correct |
631 ms |
1424 KB |
Output is correct |
4 |
Correct |
617 ms |
1352 KB |
Output is correct |
5 |
Correct |
656 ms |
1444 KB |
Output is correct |
6 |
Correct |
561 ms |
1460 KB |
Output is correct |
7 |
Correct |
748 ms |
1452 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Incorrect |
1 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |