// Ignut
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, k;
vector<int> r;
vector<int> cntInRow;
void init(int K, vector<int> R) {
n = R.size();
k = K;
r = R;
for (int val : R) r.push_back(val);
cntInRow.resize(2 * n);
cntInRow[2 * n - 1] = 1;
for (int i = 2 * n - 2; i >= 0; i --)
cntInRow[i] = (r[i] == r[i + 1] ? cntInRow[i + 1] + 1 : 1);
}
int compare_plants(int x, int y) {
if (x + cntInRow[x] >= y)
return r[x] == 1 ? -1 : 1;
if (y + cntInRow[y] - n >= x)
return r[y] == 1 ? 1 : -1;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
32 ms |
4164 KB |
Output is correct |
7 |
Correct |
44 ms |
5688 KB |
Output is correct |
8 |
Correct |
55 ms |
10196 KB |
Output is correct |
9 |
Correct |
61 ms |
10328 KB |
Output is correct |
10 |
Correct |
54 ms |
10308 KB |
Output is correct |
11 |
Correct |
53 ms |
10316 KB |
Output is correct |
12 |
Correct |
54 ms |
10184 KB |
Output is correct |
13 |
Correct |
51 ms |
10196 KB |
Output is correct |
14 |
Correct |
62 ms |
10160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
424 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
348 KB |
Output is correct |
6 |
Correct |
32 ms |
4164 KB |
Output is correct |
7 |
Correct |
44 ms |
5688 KB |
Output is correct |
8 |
Correct |
55 ms |
10196 KB |
Output is correct |
9 |
Correct |
61 ms |
10328 KB |
Output is correct |
10 |
Correct |
54 ms |
10308 KB |
Output is correct |
11 |
Correct |
53 ms |
10316 KB |
Output is correct |
12 |
Correct |
54 ms |
10184 KB |
Output is correct |
13 |
Correct |
51 ms |
10196 KB |
Output is correct |
14 |
Correct |
62 ms |
10160 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
18 |
Halted |
0 ms |
0 KB |
- |