#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
vector<int>k0, k1;
int K, n;
void init(int k, vector<int> r)
{
K = k;
n = r.size();
if (k == 2)
{
k0 = k1 = vector<int>(n, 0);
for (int t = 0; t < 2; t++)
for (int i = n - 1; i >= 0; i--)
{
if (r[i] == 0)
k0[i] = 1 + k0[(i + 1) % n];
else
k1[i] = 1 + k1[(i + 1) % n];
}
}
}
int compare_plants(int x, int y)
{
assert(x < y);
if (K == 2)
{
if (k0[x] >= y - x)
return -1;
if (k1[x] >= y - x)
return 1;
if (k0[y] >= n - y + x)
return -1;
if (k1[y] >= n - y + x)
return 1;
return 0;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |