#include <bits/stdc++.h>
using namespace std;
int K;
vector < int > R;
int n;
vector < int > order;
int ord;
void init(int k, vector < int > r){
K = k;
R = r;
n = R.size();
order.resize(n);
for (int i = 0; i < n; ++i)
{
for(int ind = 0; ind < n; ind++){
//cout << ind << endl;
if(R[ind] == 0){
bool b = false;
for(int c = 1; c < k; c++){
if(R[(ind - c + n) % n] == 0){
b = true;
ind = (ind - c + n) % n - 1;
break;
}
}
if(b){
continue;
}
for(int c = 0; c < k; c++){
R[(ind - c + n) % n]--;
}
order[ind] = ord;
//cout << ind << " ";
ord++;
break;
}
}
}
}
int compare_plants(int x, int y){
if(order[x] < order[y]){
return 1;
}
if(order[y] < order[x]){
return -1;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
2 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
13 ms |
492 KB |
Output is correct |
7 |
Correct |
333 ms |
5228 KB |
Output is correct |
8 |
Correct |
2 ms |
492 KB |
Output is correct |
9 |
Correct |
13 ms |
492 KB |
Output is correct |
10 |
Correct |
329 ms |
5224 KB |
Output is correct |
11 |
Correct |
229 ms |
5100 KB |
Output is correct |
12 |
Correct |
234 ms |
5228 KB |
Output is correct |
13 |
Correct |
396 ms |
5228 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
2 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
13 ms |
492 KB |
Output is correct |
7 |
Correct |
333 ms |
5228 KB |
Output is correct |
8 |
Correct |
2 ms |
492 KB |
Output is correct |
9 |
Correct |
13 ms |
492 KB |
Output is correct |
10 |
Correct |
329 ms |
5224 KB |
Output is correct |
11 |
Correct |
229 ms |
5100 KB |
Output is correct |
12 |
Correct |
234 ms |
5228 KB |
Output is correct |
13 |
Correct |
396 ms |
5228 KB |
Output is correct |
14 |
Correct |
2926 ms |
5792 KB |
Output is correct |
15 |
Execution timed out |
4019 ms |
9644 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
68 ms |
4972 KB |
Output is correct |
4 |
Execution timed out |
4091 ms |
8684 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
0 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |