#include "plants.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
#define pb push_back
#define fr first
#define sc second
using namespace std;
const int N=2e5+5;
int ans[N];
void init(int k, vector<int> r) {
int n=r.size();
for(int t=n-1;t>=0;t--){
vector<int> a;
for(int i=0;i<n;i++) if(r[i]==0) a.pb(i);
int v=0;
for(int i=0;i<(int)a.size();i++){
if(i==0){
if(a[i]-(a.back()-n)>=k){
v=a[i];
break;
}
}
else{
if(a[i]-a[i-1]>=k){
v=a[i];
break;
}
}
}
for(int i=v-k+1;i<=v;i++){
if(r[(i+n)%n]!=-1)
r[(i+n)%n]--;
}
r[v]=-1;
ans[v]=t;
}
}
int compare_plants(int x, int y) {
if(ans[x]>ans[y]) return 1;
else return -1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
0 ms |
312 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
9 ms |
340 KB |
Output is correct |
7 |
Correct |
224 ms |
4996 KB |
Output is correct |
8 |
Correct |
2 ms |
340 KB |
Output is correct |
9 |
Correct |
9 ms |
340 KB |
Output is correct |
10 |
Correct |
215 ms |
4992 KB |
Output is correct |
11 |
Correct |
157 ms |
4944 KB |
Output is correct |
12 |
Correct |
155 ms |
5228 KB |
Output is correct |
13 |
Correct |
255 ms |
5108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
9 ms |
340 KB |
Output is correct |
7 |
Correct |
224 ms |
4996 KB |
Output is correct |
8 |
Correct |
2 ms |
340 KB |
Output is correct |
9 |
Correct |
9 ms |
340 KB |
Output is correct |
10 |
Correct |
215 ms |
4992 KB |
Output is correct |
11 |
Correct |
157 ms |
4944 KB |
Output is correct |
12 |
Correct |
155 ms |
5228 KB |
Output is correct |
13 |
Correct |
255 ms |
5108 KB |
Output is correct |
14 |
Correct |
2302 ms |
5492 KB |
Output is correct |
15 |
Execution timed out |
4054 ms |
8708 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
53 ms |
4856 KB |
Output is correct |
4 |
Execution timed out |
4064 ms |
8140 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
308 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
316 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
0 ms |
312 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |