#include "towers.h"
#include <vector>
#include <set>
using namespace std;
vector<int>h;
int n;
void init(int N, std::vector<int> H) {
n=N;h=H;
}
int max_towers(int L, int R, int D) {
set<int> visited;
int ans = 0;
for(int i=L;i<R+1;i++){
if(visited.count(i))continue;
int l=i;
int cnt = 0;
while(true){
visited.count(l);
if(l == n-2)break;
if(h[l]<=(h[l+1]-D) and h[l+2]<=(h[l+1]-D)){
cnt++;
l+=2;
}else{
break;
}
}
ans = max(ans,cnt);
}
return ans+1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1212 ms |
916 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '3' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '3' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4014 ms |
1452 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2513 ms |
544 KB |
1st lines differ - on the 1st token, expected: '7197', found: '15' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
1st lines differ - on the 1st token, expected: '13', found: '3' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1212 ms |
916 KB |
12th lines differ - on the 1st token, expected: '2', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |