#include "towers.h"
#include<bits/stdc++.h>
int vis[5000]={0};
using namespace std;
vector<int> All;
void init(int N,vector<int> H){
for(int i=0;i<N;i++){
All.push_back(H[i]);
}
}
int max_towers(int L,int R,int D){
for(int i=L;i<=R;i++){
vis[i]=0;
}
int Max_place=-1;
int Answer=1;
int flag=1;
for(int Case=L;Case<=R;Case++){
int start=0;
int Now_max=-2000000000;
if(!flag) break;
for(int i=L;i<=R;i++){
if(All[i]>Now_max && !vis[i]){
Now_max=max(Now_max,All[i]);
Max_place=i;
}
}
vis[Max_place]=1;
int check=1;
int have_1=0;
for(int i=L;i<=R;i++){
if(vis[i]==1 && have_1) check=0;
else if(vis[i]==1 && !have_1) have_1=1;
else have_1=0;
}
//cout<<check<<endl;
if(check){
int local_Max=-2000000000;
int Block=-2000000000;
for(int i=L;i<=R;i++){
if(vis[i]){
if(local_Max+D>max(Block,Now_max) && start){
flag=0;
break;
}
Block=Now_max;
local_Max=-2000000000;
start=0;
}
else{
local_Max=max(local_Max,All[i]);
start=1;
}
}
if(local_Max+D>max(Block,Now_max) || !start){
flag=0;
break;
}
}
else{
flag=0;
}
if(flag) Answer++;
}
return Answer;
}
Compilation message
fish.cpp:1:10: fatal error: towers.h: No such file or directory
1 | #include "towers.h"
| ^~~~~~~~~~
compilation terminated.