#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> R;
vector<int> pre;
int K, N;
void init(int k, vector<int> r)
{
N = r.size();
R = r; k = K;
pre.resize(N);
int s = 0;
for (; s < N; s++)
{
if (r[s] == 0)
break;
}
for (int i = s; i < N; i++)
{
if (r[i])
pre[i] = pre[i-1] + 1;
}
if (r[0])
{
pre[0] = pre[N-1] + 1;
for (int i = 1; i < s; i++)
pre[i] = pre[i-1] + 1;
}
for (int i = 0; i < N; i++)
{
pre.push_back(pre[i]);
}
}
int compare_plants(int x, int y)
{
if (y - pre[y] <= x)
return -1;
if (x + N - pre[x+N] <= y)
return 1;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |