#include<bits/stdc++.h>
#include "towers.h"
using namespace std;
const int N=1e5;
int n,k;
vector<int>a;
void init(int N,vector<int>h){
n=N;
a=h;
for(int i=0;i<N;i++){
if((i==0||(i>0&&h[i-1]<h[i]))&&(i==n-1||(i<n-1&&h[i]>h[i+1]))){
k=i;
}
}
}
int max_towers(int l,int r,int d){
if(l==r){
return 1;
}
if(l<k&&k<r&&a[l]+d<=a[k]&&a[r]+d<=a[k]){
return 2;
}
else{
return 1;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
400 ms |
976 KB |
Output is correct |
2 |
Correct |
766 ms |
1460 KB |
Output is correct |
3 |
Correct |
498 ms |
1448 KB |
Output is correct |
4 |
Correct |
643 ms |
1568 KB |
Output is correct |
5 |
Correct |
730 ms |
1452 KB |
Output is correct |
6 |
Correct |
842 ms |
1456 KB |
Output is correct |
7 |
Correct |
882 ms |
1360 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 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 |
208 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 |
721 ms |
1452 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 |
174 ms |
552 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 |
208 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 |
400 ms |
976 KB |
Output is correct |
2 |
Correct |
766 ms |
1460 KB |
Output is correct |
3 |
Correct |
498 ms |
1448 KB |
Output is correct |
4 |
Correct |
643 ms |
1568 KB |
Output is correct |
5 |
Correct |
730 ms |
1452 KB |
Output is correct |
6 |
Correct |
842 ms |
1456 KB |
Output is correct |
7 |
Correct |
882 ms |
1360 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '1' |
12 |
Halted |
0 ms |
0 KB |
- |