#include "plants.h"
#include <bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
#define ll long long
using namespace std;
int n;
vector<int> a;
void init(int k, vector<int> r)
{
n = r.size();
a.resize(n);
for (int i = 0; i < n; i++)
r[i] = k - 1 - r[i];
for (int i = 0; i < n; i++)
{
int j = 0;
for (;; j++)
if (r[j] == 0)
break;
int cnt = 1, cur = (j - 1 + n) % n;
while (cnt < k)
{
if (r[cur] == 0)
{
j = cur;
cur = (j - 1 + n) % n;
cnt = 1;
}
else
cur = (cur - 1 + n) % n, cnt++;
}
a[j] = i;
r[j] = 1e9;
for (int t = 0; t < k; t++, j = (j - 1 + n) % n)
r[j]--;
}
return;
}
int compare_plants(int x, int y)
{
if (a[x] < a[y])
return -1;
return 1;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
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 |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
8 ms |
340 KB |
Output is correct |
7 |
Correct |
230 ms |
3084 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
8 ms |
340 KB |
Output is correct |
10 |
Correct |
216 ms |
3084 KB |
Output is correct |
11 |
Correct |
149 ms |
3088 KB |
Output is correct |
12 |
Correct |
150 ms |
3212 KB |
Output is correct |
13 |
Correct |
257 ms |
3192 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 |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
8 ms |
340 KB |
Output is correct |
7 |
Correct |
230 ms |
3084 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
8 ms |
340 KB |
Output is correct |
10 |
Correct |
216 ms |
3084 KB |
Output is correct |
11 |
Correct |
149 ms |
3088 KB |
Output is correct |
12 |
Correct |
150 ms |
3212 KB |
Output is correct |
13 |
Correct |
257 ms |
3192 KB |
Output is correct |
14 |
Correct |
1955 ms |
3276 KB |
Output is correct |
15 |
Execution timed out |
4078 ms |
4976 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 |
212 KB |
Output is correct |
3 |
Correct |
52 ms |
3036 KB |
Output is correct |
4 |
Execution timed out |
4096 ms |
4940 KB |
Time limit exceeded |
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 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |