#include <iostream>
#include <vector>
#include <set>
#include "plants"
#define INF 1000000007
using namespace std;
int n;
set<int> zero;
set<int> cur;
set<int>:: iterator it, it2;
int ans[200001];
void init(int k, vector<int> r)
{
int i;
n=r.size();
for(i=0;i<n;i++)
if(r[i]==0)
zero.insert(i);
for(i=1;i<=n;i++){
cur.clear();
it=zero.begin();
while(it!=zero.end()){
cur.insert(*it), cur.insert(*it+n);
it++;
}
it=cur.begin();
while(it!=cur.end()){
it2=it, it2++;
if(it2==cur.end())
break;
if(*it2-*it<k){
cur.erase(*it2);
cur.erase(*it2+n);
}
it++;
}
it=cur.begin();
while(it!=cur.end()){
int f=*it;
if(f>=n)
f-=n;
ans[f]=i;
zero.erase(f), zero.erase(f+n);
it++;
}
}
}
int compare_plants(int x, int y)
{
if(ans[x]==ans[y])
return 0;
else if(ans[x]>ans[y])
return 1;
return -1;
}
Compilation message
plants.cpp:4:10: fatal error: plants: No such file or directory
4 | #include "plants"
| ^~~~~~~~
compilation terminated.