#include "towers.h"
#include<bits/stdc++.h>
using namespace std;
#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
//#define int long long
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
const int mxn = 1e5 + 10;
int h[mxn], n, pos;
void init(int _n, vector<int> H) {
n = _n;
for(int i = 1; i <= n; i++) {
h[i] = H[i - 1];
}
for(int i = 2; i < n; i++) {
if(h[i] > max(h[i - 1], h[i + 1])) pos = i;
}
}
int max_towers(int L, int R, int D) {
L++;
R++;
return (L < pos && R > pos && max(h[L], h[R]) <= h[pos] - D ? 2 : 1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
339 ms |
976 KB |
Output is correct |
2 |
Correct |
771 ms |
1500 KB |
Output is correct |
3 |
Correct |
554 ms |
1352 KB |
Output is correct |
4 |
Correct |
735 ms |
1352 KB |
Output is correct |
5 |
Correct |
691 ms |
1352 KB |
Output is correct |
6 |
Correct |
666 ms |
1468 KB |
Output is correct |
7 |
Correct |
606 ms |
1360 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 |
495 ms |
1452 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 |
178 ms |
464 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 |
339 ms |
976 KB |
Output is correct |
2 |
Correct |
771 ms |
1500 KB |
Output is correct |
3 |
Correct |
554 ms |
1352 KB |
Output is correct |
4 |
Correct |
735 ms |
1352 KB |
Output is correct |
5 |
Correct |
691 ms |
1352 KB |
Output is correct |
6 |
Correct |
666 ms |
1468 KB |
Output is correct |
7 |
Correct |
606 ms |
1360 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 |
- |