#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> pre(2000005);
int n;
int cnt = 0;
void init(int k, std::vector<int> r) {
n = r.size();
for(int i = 0; i < n; i++){
pre[i + 1] = pre[i] + r[i];
cnt += r[i];
}
return;
}
int compare_plants(int x, int y) {
if(pre[y] - pre[x] == y - x){
return -1;
}
if(pre[y] - pre[x] == 0){
return 1;
}
if (cnt - (pre[y] - pre[x]) == n - (y - x)){
return 1;
}
else if (cnt - (pre[y] - pre[x]) == 0){
return -1;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
8192 KB |
Output is correct |
2 |
Correct |
5 ms |
8192 KB |
Output is correct |
3 |
Correct |
5 ms |
8192 KB |
Output is correct |
4 |
Correct |
6 ms |
8192 KB |
Output is correct |
5 |
Correct |
5 ms |
8192 KB |
Output is correct |
6 |
Correct |
72 ms |
11000 KB |
Output is correct |
7 |
Correct |
88 ms |
11128 KB |
Output is correct |
8 |
Correct |
115 ms |
12152 KB |
Output is correct |
9 |
Correct |
110 ms |
12024 KB |
Output is correct |
10 |
Correct |
111 ms |
12024 KB |
Output is correct |
11 |
Correct |
110 ms |
12024 KB |
Output is correct |
12 |
Correct |
110 ms |
12024 KB |
Output is correct |
13 |
Correct |
108 ms |
12024 KB |
Output is correct |
14 |
Correct |
110 ms |
12060 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
8192 KB |
Output is correct |
2 |
Correct |
5 ms |
8192 KB |
Output is correct |
3 |
Incorrect |
5 ms |
8192 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
8192 KB |
Output is correct |
2 |
Correct |
5 ms |
8192 KB |
Output is correct |
3 |
Incorrect |
5 ms |
8192 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
8192 KB |
Output is correct |
2 |
Incorrect |
5 ms |
8192 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
8192 KB |
Output is correct |
2 |
Correct |
6 ms |
8168 KB |
Output is correct |
3 |
Correct |
6 ms |
8192 KB |
Output is correct |
4 |
Incorrect |
6 ms |
8192 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
8192 KB |
Output is correct |
2 |
Correct |
6 ms |
8192 KB |
Output is correct |
3 |
Correct |
5 ms |
8192 KB |
Output is correct |
4 |
Incorrect |
5 ms |
8192 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
8192 KB |
Output is correct |
2 |
Correct |
5 ms |
8192 KB |
Output is correct |
3 |
Correct |
5 ms |
8192 KB |
Output is correct |
4 |
Correct |
6 ms |
8192 KB |
Output is correct |
5 |
Correct |
5 ms |
8192 KB |
Output is correct |
6 |
Correct |
72 ms |
11000 KB |
Output is correct |
7 |
Correct |
88 ms |
11128 KB |
Output is correct |
8 |
Correct |
115 ms |
12152 KB |
Output is correct |
9 |
Correct |
110 ms |
12024 KB |
Output is correct |
10 |
Correct |
111 ms |
12024 KB |
Output is correct |
11 |
Correct |
110 ms |
12024 KB |
Output is correct |
12 |
Correct |
110 ms |
12024 KB |
Output is correct |
13 |
Correct |
108 ms |
12024 KB |
Output is correct |
14 |
Correct |
110 ms |
12060 KB |
Output is correct |
15 |
Correct |
6 ms |
8192 KB |
Output is correct |
16 |
Correct |
5 ms |
8192 KB |
Output is correct |
17 |
Incorrect |
5 ms |
8192 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |