#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define pb push_back
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> plant;
void init(int k, vector<int> r){
int N = SZ(r);
plant.resize(N);
for(int p = N-1; p >= 0; p--){
for(int i = 0; i < N; i++){
if(r[i] == 0){
int id = i;
for(i = i + k; ; i++){
if(r[i % N] == 0){
id = i % N;
break;
}
}
plant[id] = p;
r[id] = -1;
for(int i = id - 1; i >= id - (k - 1); i--){
r[(i + N) % N]--;
}
}
}
}
}
int compare_plants(int x, int y) {
if(plant[x] > plant[y])
return 1;
else if(plant[x] < plant[y])
return -1;
else
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
236 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
8 ms |
364 KB |
Output is correct |
7 |
Correct |
211 ms |
3180 KB |
Output is correct |
8 |
Correct |
2 ms |
396 KB |
Output is correct |
9 |
Correct |
8 ms |
364 KB |
Output is correct |
10 |
Correct |
211 ms |
3308 KB |
Output is correct |
11 |
Correct |
205 ms |
3180 KB |
Output is correct |
12 |
Correct |
205 ms |
3348 KB |
Output is correct |
13 |
Correct |
208 ms |
3180 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
492 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
8 ms |
364 KB |
Output is correct |
7 |
Correct |
211 ms |
3180 KB |
Output is correct |
8 |
Correct |
2 ms |
396 KB |
Output is correct |
9 |
Correct |
8 ms |
364 KB |
Output is correct |
10 |
Correct |
211 ms |
3308 KB |
Output is correct |
11 |
Correct |
205 ms |
3180 KB |
Output is correct |
12 |
Correct |
205 ms |
3348 KB |
Output is correct |
13 |
Correct |
208 ms |
3180 KB |
Output is correct |
14 |
Correct |
2168 ms |
3480 KB |
Output is correct |
15 |
Execution timed out |
4029 ms |
8684 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
68 ms |
3564 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
236 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
0 ms |
364 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |