#include <plants.h>
#include <bits/stdc++.h>
using namespace std;
vector <int> s;
int n;
void init(int k, vector <int> r)
{
n = r.size();
s.push_back(0);
for (int i: r) {
s.push_back(s.back() + i);
}
}
int compare_plants(int x, int y)
{
if (x > y) return -compare_plants(y, x);
if (s[x] == s[y]) return 1;
if (s[y] == s[n] and s[0] == s[x]) return -1;
if (s[x] - x == s[y] - y) return -1;
if (s[y] - y == s[n] - n and s[0] == s[x] - x) return 1;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
60 ms |
4076 KB |
Output is correct |
7 |
Correct |
77 ms |
5556 KB |
Output is correct |
8 |
Correct |
97 ms |
8292 KB |
Output is correct |
9 |
Correct |
92 ms |
7524 KB |
Output is correct |
10 |
Correct |
93 ms |
6884 KB |
Output is correct |
11 |
Correct |
93 ms |
7652 KB |
Output is correct |
12 |
Correct |
114 ms |
6884 KB |
Output is correct |
13 |
Correct |
96 ms |
8292 KB |
Output is correct |
14 |
Correct |
87 ms |
6884 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
364 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Correct |
60 ms |
4076 KB |
Output is correct |
7 |
Correct |
77 ms |
5556 KB |
Output is correct |
8 |
Correct |
97 ms |
8292 KB |
Output is correct |
9 |
Correct |
92 ms |
7524 KB |
Output is correct |
10 |
Correct |
93 ms |
6884 KB |
Output is correct |
11 |
Correct |
93 ms |
7652 KB |
Output is correct |
12 |
Correct |
114 ms |
6884 KB |
Output is correct |
13 |
Correct |
96 ms |
8292 KB |
Output is correct |
14 |
Correct |
87 ms |
6884 KB |
Output is correct |
15 |
Correct |
1 ms |
364 KB |
Output is correct |
16 |
Correct |
1 ms |
364 KB |
Output is correct |
17 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |