#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
int pSum[MAXN+1], n;
void init(int k, vector<int> r) {
n = r.size();
pSum[0] = 0;
for(int i = 0; i < n; i++) {
pSum[i+1] = pSum[i] + r[i];
}
return;
}
int compare_plants(int x, int y) {
if(pSum[y] - pSum[x] == 0 || (pSum[n]-pSum[y] == n-y && pSum[x] == x))
return 1;
else if (pSum[y] - pSum[x] == y-x || (pSum[n]-pSum[y] == 0 && pSum[x] == 0))
return -1;
else
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
66 ms |
4024 KB |
Output is correct |
7 |
Correct |
77 ms |
5412 KB |
Output is correct |
8 |
Correct |
93 ms |
7876 KB |
Output is correct |
9 |
Correct |
107 ms |
7892 KB |
Output is correct |
10 |
Correct |
89 ms |
7896 KB |
Output is correct |
11 |
Correct |
86 ms |
7912 KB |
Output is correct |
12 |
Correct |
85 ms |
7900 KB |
Output is correct |
13 |
Correct |
108 ms |
7876 KB |
Output is correct |
14 |
Correct |
141 ms |
7872 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
224 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
66 ms |
4024 KB |
Output is correct |
7 |
Correct |
77 ms |
5412 KB |
Output is correct |
8 |
Correct |
93 ms |
7876 KB |
Output is correct |
9 |
Correct |
107 ms |
7892 KB |
Output is correct |
10 |
Correct |
89 ms |
7896 KB |
Output is correct |
11 |
Correct |
86 ms |
7912 KB |
Output is correct |
12 |
Correct |
85 ms |
7900 KB |
Output is correct |
13 |
Correct |
108 ms |
7876 KB |
Output is correct |
14 |
Correct |
141 ms |
7872 KB |
Output is correct |
15 |
Correct |
0 ms |
204 KB |
Output is correct |
16 |
Correct |
1 ms |
204 KB |
Output is correct |
17 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |