#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> last;
void init(int k, vector<int> r)
{
n = r.size();
last.resize(2 * n);
for (int i = 0; i < n; i++)
r.emplace_back(r[i]);
for (int i = 1; i < 2 * n; i++)
r[i] += r[i - 1];
last = r;
return;
}
int compare_plants(int x, int y)
{
int sum = last[y - 1] - (x ? last[x - 1] : 0);
if (sum == y - x || last[n - 1] - sum == 0)
return -1;
if (sum == 0 || last[n - 1] - sum == n - (y - x))
return 1;
return 0;
}
# |
Verdict |
Execution time |
Memory |
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 |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
39 ms |
3044 KB |
Output is correct |
7 |
Correct |
43 ms |
3340 KB |
Output is correct |
8 |
Correct |
57 ms |
6496 KB |
Output is correct |
9 |
Correct |
69 ms |
6504 KB |
Output is correct |
10 |
Correct |
57 ms |
6512 KB |
Output is correct |
11 |
Correct |
56 ms |
6476 KB |
Output is correct |
12 |
Correct |
58 ms |
6520 KB |
Output is correct |
13 |
Correct |
54 ms |
6512 KB |
Output is correct |
14 |
Correct |
56 ms |
6480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 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 |
- |
# |
Verdict |
Execution time |
Memory |
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 |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
39 ms |
3044 KB |
Output is correct |
7 |
Correct |
43 ms |
3340 KB |
Output is correct |
8 |
Correct |
57 ms |
6496 KB |
Output is correct |
9 |
Correct |
69 ms |
6504 KB |
Output is correct |
10 |
Correct |
57 ms |
6512 KB |
Output is correct |
11 |
Correct |
56 ms |
6476 KB |
Output is correct |
12 |
Correct |
58 ms |
6520 KB |
Output is correct |
13 |
Correct |
54 ms |
6512 KB |
Output is correct |
14 |
Correct |
56 ms |
6480 KB |
Output is correct |
15 |
Correct |
0 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |