#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
int K, N;
vector<int> ps;
void init(int k, vector<int> r)
{
K = k;
N = (int)r.size();
r.insert(r.end(), r.begin(), r.end());
ps = vector<int>(N*2|1);
for (int i = 0; i < 2*N; i++)
ps[i+1] = ps[i] + r[i];
}
int compare_plants(int x, int y)
{
if (ps[y] - ps[x] == 0 || ps[x+N] - ps[y] == N + x - y)
return 1;
if (ps[y] - ps[x] == y - x || ps[x+N] - ps[y] == 0)
return -1;
return 0;
}
#ifdef TEST
#include "grader.cpp"
#endif
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
35 ms |
4180 KB |
Output is correct |
7 |
Correct |
42 ms |
5592 KB |
Output is correct |
8 |
Correct |
49 ms |
9432 KB |
Output is correct |
9 |
Correct |
52 ms |
9444 KB |
Output is correct |
10 |
Correct |
54 ms |
9516 KB |
Output is correct |
11 |
Correct |
53 ms |
9540 KB |
Output is correct |
12 |
Correct |
52 ms |
9436 KB |
Output is correct |
13 |
Correct |
52 ms |
9548 KB |
Output is correct |
14 |
Correct |
54 ms |
9548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
356 KB |
Output is correct |
2 |
Incorrect |
0 ms |
360 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
360 KB |
Output is correct |
2 |
Correct |
0 ms |
360 KB |
Output is correct |
3 |
Correct |
1 ms |
352 KB |
Output is correct |
4 |
Incorrect |
1 ms |
360 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
360 KB |
Output is correct |
2 |
Correct |
1 ms |
360 KB |
Output is correct |
3 |
Correct |
0 ms |
360 KB |
Output is correct |
4 |
Incorrect |
0 ms |
360 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
600 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
35 ms |
4180 KB |
Output is correct |
7 |
Correct |
42 ms |
5592 KB |
Output is correct |
8 |
Correct |
49 ms |
9432 KB |
Output is correct |
9 |
Correct |
52 ms |
9444 KB |
Output is correct |
10 |
Correct |
54 ms |
9516 KB |
Output is correct |
11 |
Correct |
53 ms |
9540 KB |
Output is correct |
12 |
Correct |
52 ms |
9436 KB |
Output is correct |
13 |
Correct |
52 ms |
9548 KB |
Output is correct |
14 |
Correct |
54 ms |
9548 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |