#include "towers.h"
#include <bits/stdc++.h>
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;
vector<int> v,pre;
void init(int n, vector<int> h) {
v=h;
pre.resize(n);
for(int i=1;i+1<n;i++){
if(v[i]<v[i-1] && v[i]<v[i+1]){
pre[i]=1;
}
}
for(int i=1;i<n;i++){
pre[i]+=pre[i-1];
}
}
int max_towers(int l, int r, int d) {
if(l==r){
return 1;
}
int u=pre[r];
if(l){
u-=pre[l-1];
}
if(v[l]<v[l+1]){
u++;
}
if(v[r]<v[r-1]){
u++;
}
return u;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
287 ms |
1232 KB |
2nd lines differ - on the 1st token, expected: '1', 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: '16' |
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: '16' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
466 ms |
1824 KB |
2nd lines differ - on the 1st token, expected: '4770', found: '4771' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
184 ms |
652 KB |
1st lines differ - on the 1st token, expected: '7197', found: '8004' |
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: '16' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
287 ms |
1232 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |