#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
#define F first
#define S second
#define all(x) (x).begin(),(x).end()
const int N = 3e5+5;
const int MOD = 1e9+7;
const ll INF = 1e18+5;
#ifdef dremix
#define p(x) cerr<<#x<<" = "<<x<<endl;
#define pv(x) cerr<<#x<<" = {";for(auto v : x)cerr<<v<<", ";cerr<<"}"<<endl;
#else
#define p(x) {}
#define pv(x) {}
#endif
vector<int> arr;
int n,k;
void init(int N, vector<int> H) {
n = N;
arr = H;
int i;
k = 0;
for(i=1;i<n;i++){
if(arr[i] > arr[i-1])k = i;
}
}
int max_towers(int L, int R, int D) {
if(L < k && R > k && arr[L] + D <= arr[k] && arr[R] + D <= arr[k])return 2;
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
391 ms |
976 KB |
Output is correct |
2 |
Correct |
796 ms |
1436 KB |
Output is correct |
3 |
Correct |
530 ms |
1360 KB |
Output is correct |
4 |
Correct |
550 ms |
1436 KB |
Output is correct |
5 |
Correct |
717 ms |
1444 KB |
Output is correct |
6 |
Correct |
582 ms |
1480 KB |
Output is correct |
7 |
Correct |
549 ms |
1456 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
325 ms |
1472 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 |
193 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 |
0 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 |
391 ms |
976 KB |
Output is correct |
2 |
Correct |
796 ms |
1436 KB |
Output is correct |
3 |
Correct |
530 ms |
1360 KB |
Output is correct |
4 |
Correct |
550 ms |
1436 KB |
Output is correct |
5 |
Correct |
717 ms |
1444 KB |
Output is correct |
6 |
Correct |
582 ms |
1480 KB |
Output is correct |
7 |
Correct |
549 ms |
1456 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 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 |
- |