#include "plants.h"
#include<bits/stdc++.h>
using namespace std;
using ll = int;
namespace{
vector<ll> r,rk;
ll n,k;
}
void init(int K, std::vector<int> R) {
n = r.size();
k = K;
r = R;
rk.resize(n,-1);
vector<ll> a = R;
for(ll t = 0;t<n;t++){
vector<ll> zs;
for(ll i = 0;i<n;i++) if(rk[i]==-1&&R[i]<=0) zs.push_back(i);
ll zz = zs[0];
if(zs.size()>1){
if ((zs[0]-zs[1]+n)%n<=k-1)zz = zs[1];
}
rk[zz] = t;
for(ll i = 0;i<k;i++) a[(zz-i+n)%n]--;
}
}
int compare_plants(int x, int y) {
if (rk[x]<rk[y]) return 1;
else return -1;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |