#include <bits/stdc++.h>
using namespace std;
const int N = 500000;
int n, k;
vector<int> r;
int p[N];
void init(int _k, vector<int> _r)
{
n = _r.size();
r = _r;
k = _k;
for (int i = 0; i < n; i++)
{
p[i] = p[i - 1] + r[i];
}
}
int compare_plants(int x, int y)
{
if (x < y)
{
if (p[y - 1] - p[x - 1] == 0)
{
return 1;
}
if (p[y - 1] - p[x - 1] == y - x)
{
return -1;
}
if (p[n - 1] - p[y - 1] + p[x - 1] == 0)
{
return -1;
}
if (p[n - 1] - p[y - 1] + p[x - 1] == n - y + x)
{
return 1;
}
return 0;
}
return -2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
64 ms |
3112 KB |
Output is correct |
7 |
Correct |
87 ms |
3448 KB |
Output is correct |
8 |
Correct |
109 ms |
5752 KB |
Output is correct |
9 |
Correct |
108 ms |
5752 KB |
Output is correct |
10 |
Correct |
108 ms |
5880 KB |
Output is correct |
11 |
Correct |
107 ms |
5752 KB |
Output is correct |
12 |
Correct |
117 ms |
5752 KB |
Output is correct |
13 |
Correct |
102 ms |
5752 KB |
Output is correct |
14 |
Correct |
106 ms |
5752 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
288 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
256 KB |
Output is correct |
4 |
Correct |
0 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
64 ms |
3112 KB |
Output is correct |
7 |
Correct |
87 ms |
3448 KB |
Output is correct |
8 |
Correct |
109 ms |
5752 KB |
Output is correct |
9 |
Correct |
108 ms |
5752 KB |
Output is correct |
10 |
Correct |
108 ms |
5880 KB |
Output is correct |
11 |
Correct |
107 ms |
5752 KB |
Output is correct |
12 |
Correct |
117 ms |
5752 KB |
Output is correct |
13 |
Correct |
102 ms |
5752 KB |
Output is correct |
14 |
Correct |
106 ms |
5752 KB |
Output is correct |
15 |
Correct |
0 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
256 KB |
Output is correct |
17 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |