#include <iostream>
#include <vector>
#include "plants.h"
using namespace std;
int n, h, i;
vector<int> v, s;
void init(int k, vector<int> r)
{
v = r;
n = r.size();
h = k;
s.resize(n + 1);
s[0] = 0;
for (i = 0; i < n; i++)
s[i + 1] = s[i] + r[i];
}
int compare_plants(int x, int y)
{
if (s[y] - s[x] == y - x)
return -1;
if (s[y] - s[x] == 0)
return 1;
if (s[x] + s[n] - s[y] == x + n - y)
return 1;
if (s[x] + s[n] - s[y] == 0)
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 |
38 ms |
3048 KB |
Output is correct |
7 |
Correct |
43 ms |
3328 KB |
Output is correct |
8 |
Correct |
57 ms |
8652 KB |
Output is correct |
9 |
Correct |
57 ms |
8676 KB |
Output is correct |
10 |
Correct |
60 ms |
8676 KB |
Output is correct |
11 |
Correct |
57 ms |
8652 KB |
Output is correct |
12 |
Correct |
59 ms |
8672 KB |
Output is correct |
13 |
Correct |
55 ms |
8652 KB |
Output is correct |
14 |
Correct |
55 ms |
8624 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 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 |
0 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 |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 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 |
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 |
38 ms |
3048 KB |
Output is correct |
7 |
Correct |
43 ms |
3328 KB |
Output is correct |
8 |
Correct |
57 ms |
8652 KB |
Output is correct |
9 |
Correct |
57 ms |
8676 KB |
Output is correct |
10 |
Correct |
60 ms |
8676 KB |
Output is correct |
11 |
Correct |
57 ms |
8652 KB |
Output is correct |
12 |
Correct |
59 ms |
8672 KB |
Output is correct |
13 |
Correct |
55 ms |
8652 KB |
Output is correct |
14 |
Correct |
55 ms |
8624 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
212 KB |
Output is correct |
17 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |