#include "towers.h"
#include <bits/stdc++.h>
using namespace std;
#include <vector>
vector<int> arr;
int n;
int st;
void init(int N, std::vector<int> H) {
arr=H;
n=N;
for (int i = 0; i < N; i++){
if (H[i]<H[st]) st=i;
}
}
int max_towers(int L, int R, int D) {
int mava = -23;
int ans = 1;
int nmiva = arr[st];
for (int i = st+1; i < n; i++){
if (mava>=nmiva+D && mava>=arr[i]+D){
mava=-23;
ans++;
nmiva=max(nmiva,arr[i]);
}
mava=max(mava,arr[i]);
}
mava=-23;
for (int i = st-1; i >= 0; i--){
if (mava>=nmiva+D && mava>=arr[i]+D){
mava=-23;
ans++;
nmiva=max(nmiva,arr[i]);
}
mava=max(mava,arr[i]);
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2975 ms |
996 KB |
1st 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: '34' |
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: '34' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4030 ms |
1360 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1117 ms |
556 KB |
1st lines differ - on the 1st token, expected: '7197', found: '394' |
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: '34' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2975 ms |
996 KB |
1st lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |