#include "plants.h"
#include <vector>
using namespace std;
int n;
vector<int> pref;
void init(int k, vector<int> r){
n = r.size();
pref.resize(n + 1);
for(int i = 1; i <= n; i ++)
pref[i] = pref[i - 1] + r[i - 1];
return;
}
int compare_plants(int x, int y){
if(pref[y] == pref[x]) return 1;
if(pref[y] - pref[x] == y - x) return -1;
if(pref[n] - (pref[y] - pref[x]) == n - (y - x)) return 1;
if(pref[n] == (pref[y] - pref[x])) return -1;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
74 ms |
3192 KB |
Output is correct |
7 |
Correct |
88 ms |
3320 KB |
Output is correct |
8 |
Correct |
111 ms |
4984 KB |
Output is correct |
9 |
Correct |
107 ms |
5112 KB |
Output is correct |
10 |
Correct |
110 ms |
5112 KB |
Output is correct |
11 |
Correct |
110 ms |
4984 KB |
Output is correct |
12 |
Correct |
106 ms |
5240 KB |
Output is correct |
13 |
Correct |
105 ms |
4984 KB |
Output is correct |
14 |
Correct |
103 ms |
4984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
0 ms |
384 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
0 ms |
256 KB |
Output is correct |
6 |
Correct |
74 ms |
3192 KB |
Output is correct |
7 |
Correct |
88 ms |
3320 KB |
Output is correct |
8 |
Correct |
111 ms |
4984 KB |
Output is correct |
9 |
Correct |
107 ms |
5112 KB |
Output is correct |
10 |
Correct |
110 ms |
5112 KB |
Output is correct |
11 |
Correct |
110 ms |
4984 KB |
Output is correct |
12 |
Correct |
106 ms |
5240 KB |
Output is correct |
13 |
Correct |
105 ms |
4984 KB |
Output is correct |
14 |
Correct |
103 ms |
4984 KB |
Output is correct |
15 |
Correct |
1 ms |
256 KB |
Output is correct |
16 |
Correct |
1 ms |
384 KB |
Output is correct |
17 |
Incorrect |
0 ms |
256 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |