#include "towers.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
using ll = int;
ll n;
vector<ll> h;
ll mx;
struct obj{
ll v,c;
bool operator<(const obj &o) const{
return v<o.v;
}
bool operator>(const obj &o) const{
return v>o.v;
}
};
void init(int N, std::vector<int> H) {
n = N;
h = H;
for(ll i = 0;i<n;i++) if((i==0||(h[i-1]<h[i]))&&(i==n-1||h[i]>h[i+1])) mx = i;
}
int max_towers(int L, int R, int D) {
/*ll l = L, r = R, d = D;
ll ans = 1;
vector<obj> a,b;
a.push_back({0,0});
for(ll i = l;i<=r;i++){
ll cur = 0;
obj oa = {h[i],cur+1};
while(a.size()&&a.back().v>=h[i]) a.pop_back();
a.push_back(oa);
}*/
return 1+(L<mx&&mx<R&&max(h[L],h[R])<=h[mx]-D);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
304 ms |
1112 KB |
Output is correct |
2 |
Correct |
538 ms |
1368 KB |
Output is correct |
3 |
Correct |
571 ms |
1368 KB |
Output is correct |
4 |
Correct |
629 ms |
1368 KB |
Output is correct |
5 |
Correct |
645 ms |
1368 KB |
Output is correct |
6 |
Correct |
606 ms |
1368 KB |
Output is correct |
7 |
Correct |
623 ms |
1368 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 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 |
471 ms |
1368 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 |
160 ms |
688 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 |
304 ms |
1112 KB |
Output is correct |
2 |
Correct |
538 ms |
1368 KB |
Output is correct |
3 |
Correct |
571 ms |
1368 KB |
Output is correct |
4 |
Correct |
629 ms |
1368 KB |
Output is correct |
5 |
Correct |
645 ms |
1368 KB |
Output is correct |
6 |
Correct |
606 ms |
1368 KB |
Output is correct |
7 |
Correct |
623 ms |
1368 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
1 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 |
- |