#include "towers.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
#include <vector>
const int N = 100100;
int cnt[N];
int h[N];
vector<int> pos;
#define pico ahiusuhashuis
vector<int> pico;
int good[N];
void init(int N, std::vector<int> H) {
for(int i=0;i<N;i++)h[i] = H[i];
for(int i=0;i<N;i++){
int l = (i == 0 || H[i] < H[i-1]);
int r = (i == N-1 || H[i] < H[i+1]);
if(l && r){
cnt[i]++;
good[i]=1;
}
if(i)cnt[i]+=cnt[i-1];
}
}
int max_towers(int L, int R, int D) {
if(L==R)return 1;
int qtd = cnt[R] - (L>0?cnt[L-1]:0);
if(h[L] < h[L+1] && !good[L])qtd++;
if(h[R] < h[R-1] && !good[R])qtd++;
return max(1,qtd);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
223 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 |
Correct |
555 ms |
2120 KB |
Output is correct |
2 |
Correct |
761 ms |
2212 KB |
Output is correct |
3 |
Correct |
789 ms |
2212 KB |
Output is correct |
4 |
Correct |
773 ms |
2128 KB |
Output is correct |
5 |
Correct |
865 ms |
2200 KB |
Output is correct |
6 |
Correct |
624 ms |
2120 KB |
Output is correct |
7 |
Correct |
730 ms |
2120 KB |
Output is correct |
8 |
Correct |
910 ms |
1832 KB |
Output is correct |
9 |
Correct |
881 ms |
1736 KB |
Output is correct |
10 |
Correct |
679 ms |
1872 KB |
Output is correct |
11 |
Correct |
722 ms |
1872 KB |
Output is correct |
12 |
Correct |
801 ms |
1832 KB |
Output is correct |
13 |
Correct |
878 ms |
1736 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
1 ms |
336 KB |
Output is correct |
17 |
Correct |
13 ms |
2212 KB |
Output is correct |
18 |
Correct |
23 ms |
2236 KB |
Output is correct |
19 |
Correct |
11 ms |
2120 KB |
Output is correct |
20 |
Correct |
11 ms |
1824 KB |
Output is correct |
21 |
Correct |
12 ms |
1872 KB |
Output is correct |
22 |
Correct |
12 ms |
2228 KB |
Output is correct |
23 |
Correct |
14 ms |
2204 KB |
Output is correct |
24 |
Correct |
12 ms |
2120 KB |
Output is correct |
25 |
Correct |
12 ms |
1844 KB |
Output is correct |
26 |
Correct |
13 ms |
1836 KB |
Output is correct |
27 |
Correct |
1 ms |
336 KB |
Output is correct |
28 |
Correct |
1 ms |
300 KB |
Output is correct |
29 |
Correct |
1 ms |
336 KB |
Output is correct |
30 |
Correct |
1 ms |
336 KB |
Output is correct |
31 |
Correct |
1 ms |
336 KB |
Output is correct |
32 |
Correct |
1 ms |
336 KB |
Output is correct |
33 |
Correct |
1 ms |
336 KB |
Output is correct |
34 |
Correct |
1 ms |
336 KB |
Output is correct |
35 |
Correct |
1 ms |
336 KB |
Output is correct |
36 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
211 ms |
720 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 |
223 ms |
1232 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |