#include <bits/stdc++.h>
#include "towers.h"
using namespace std;
long long a[100069],ps[100069];
void init(int n,vector<int> aa)
{
long long i;
for(i=1;i<=n;i++)
{
a[i]=aa[i-1];
}
for(i=1;i<=n;i++)
{
ps[i]=ps[i-1]+(i>1&&i<n&&a[i]<a[i-1]&&a[i]<a[i+1]);
}
}
int max_towers(int lb,int rb,int cw)
{
lb++;
rb++;
if(lb==rb)
{
return 1;
}
else
{
return ps[rb-1]-ps[lb]+(a[lb]<a[lb+1])+(a[rb]<a[rb-1]);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
267 ms |
1568 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 |
400 ms |
2584 KB |
Output is correct |
2 |
Correct |
589 ms |
2504 KB |
Output is correct |
3 |
Correct |
883 ms |
2584 KB |
Output is correct |
4 |
Correct |
688 ms |
2600 KB |
Output is correct |
5 |
Correct |
805 ms |
2632 KB |
Output is correct |
6 |
Correct |
724 ms |
2596 KB |
Output is correct |
7 |
Correct |
884 ms |
2620 KB |
Output is correct |
8 |
Correct |
725 ms |
2580 KB |
Output is correct |
9 |
Correct |
694 ms |
2608 KB |
Output is correct |
10 |
Correct |
845 ms |
2592 KB |
Output is correct |
11 |
Correct |
758 ms |
2604 KB |
Output is correct |
12 |
Correct |
798 ms |
2592 KB |
Output is correct |
13 |
Correct |
839 ms |
2600 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
336 KB |
Output is correct |
16 |
Correct |
0 ms |
336 KB |
Output is correct |
17 |
Correct |
14 ms |
2600 KB |
Output is correct |
18 |
Correct |
20 ms |
2632 KB |
Output is correct |
19 |
Correct |
11 ms |
2620 KB |
Output is correct |
20 |
Correct |
12 ms |
2728 KB |
Output is correct |
21 |
Correct |
13 ms |
2632 KB |
Output is correct |
22 |
Correct |
11 ms |
2584 KB |
Output is correct |
23 |
Correct |
20 ms |
2592 KB |
Output is correct |
24 |
Correct |
15 ms |
2708 KB |
Output is correct |
25 |
Correct |
18 ms |
2584 KB |
Output is correct |
26 |
Correct |
11 ms |
2640 KB |
Output is correct |
27 |
Correct |
1 ms |
336 KB |
Output is correct |
28 |
Correct |
1 ms |
336 KB |
Output is correct |
29 |
Correct |
1 ms |
336 KB |
Output is correct |
30 |
Correct |
1 ms |
236 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 |
228 ms |
848 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 |
267 ms |
1568 KB |
2nd lines differ - on the 1st token, expected: '1', found: '2' |
2 |
Halted |
0 ms |
0 KB |
- |