#include <bits/stdc++.h>
#include "plants.h"
using namespace std;
const int nax = 2e5 + 2;
int val[nax], n, k;
bool done[nax];
bool cmp(int x, int y) {
if(x + k - 1 < n) {
return y > x && y <= x + k - 1;
} else {
if(y < x) return (x + k - 1) % n >= y;
else return y > x;
}
}
void init(int K, vector<int> r) {
k = K;
n = r.size();
for(int tg=1; tg<=n; ++tg) {
int mn = -1;
for(int i=0; i<n; ++i) if(!done[i] && r[i]==k-1) {
if(mn==-1) mn = i;
else if(!cmp(mn, i)) mn = i;
}
val[mn] = tg;
done[mn] = true;
for(int i=mn, cnt=0; cnt<k; ++cnt, i=(i-1+n)%n) {
++r[i];
}
}
}
int compare_plants(int x, int y) {
if(val[x]>val[y]) return 1;
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
6 ms |
372 KB |
Output is correct |
7 |
Correct |
163 ms |
3100 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
6 ms |
340 KB |
Output is correct |
10 |
Correct |
155 ms |
3100 KB |
Output is correct |
11 |
Correct |
108 ms |
3020 KB |
Output is correct |
12 |
Correct |
125 ms |
3448 KB |
Output is correct |
13 |
Correct |
181 ms |
3104 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
6 ms |
372 KB |
Output is correct |
7 |
Correct |
163 ms |
3100 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
6 ms |
340 KB |
Output is correct |
10 |
Correct |
155 ms |
3100 KB |
Output is correct |
11 |
Correct |
108 ms |
3020 KB |
Output is correct |
12 |
Correct |
125 ms |
3448 KB |
Output is correct |
13 |
Correct |
181 ms |
3104 KB |
Output is correct |
14 |
Correct |
1853 ms |
3292 KB |
Output is correct |
15 |
Execution timed out |
4011 ms |
8920 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
304 KB |
Output is correct |
3 |
Runtime error |
37 ms |
5244 KB |
Execution killed with signal 6 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 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 |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |