#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define pb push_back
#define eb emplace_back
const int maxn = 2e5 + 5;
const int INF = 1e9;
#include "plants.h"
int rk[maxn];
int n, k;
vector<int> r;
void init(int _k, std::vector<int> _r) {
r = _r, k = _k;
n = r.size();
for(auto x : _r) r.pb(x);
auto del = [&](int x) -> void {
for(int i = max(0, x - k + 1); i < x; i++) r[i] --;
x += n;
for(int i = x - k + 1; i < x; i++) r[i] --;
};
for(int rd = 0; rd < n; rd++){
int csc = 0;
for(int i = 0; i < 2 * n; i++){
if(r[i] == 0){
if(csc >= n - k){
cout<<"ok : "<<i<<"\n";
del(i % n);
rk[i % n] = rd;
r[i] = r[(i + n) % (2 * n)] = INF;
break;
}
csc = 0;
}
else csc++;
}
}
return;
}
int compare_plants(int x, int y) {\
return rk[x] < rk[y] ? 1 : -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |