#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> o, z;
#define lb(x, v) lower_bound(x.begin(), x.end(), v)
bool ok (int x, int y, vector<int> &b) {
if (x > y) {
return lb(b, x) == b.end() && lb(b, y) == b.begin();
}
return lb(b, x) == lb(b, y);
}
void init(int k, vector<int> r) {
int n = r.size();
for (int i = 0; i < n; ++i) {
(r[i] ? o : z).push_back(i);
}
}
int compare_plants(int x, int y) {
return ok(x, y, o) || ok(y, x, z) ? 1 : ok(x, y, z) || ok(y, x, o) ? -1 : 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
74 ms |
4040 KB |
Output is correct |
7 |
Correct |
157 ms |
5492 KB |
Output is correct |
8 |
Correct |
217 ms |
8032 KB |
Output is correct |
9 |
Correct |
203 ms |
8032 KB |
Output is correct |
10 |
Correct |
200 ms |
8120 KB |
Output is correct |
11 |
Correct |
171 ms |
8276 KB |
Output is correct |
12 |
Correct |
160 ms |
8124 KB |
Output is correct |
13 |
Correct |
90 ms |
8252 KB |
Output is correct |
14 |
Correct |
153 ms |
8380 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 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 |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
288 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
292 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
288 KB |
Output is correct |
4 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
74 ms |
4040 KB |
Output is correct |
7 |
Correct |
157 ms |
5492 KB |
Output is correct |
8 |
Correct |
217 ms |
8032 KB |
Output is correct |
9 |
Correct |
203 ms |
8032 KB |
Output is correct |
10 |
Correct |
200 ms |
8120 KB |
Output is correct |
11 |
Correct |
171 ms |
8276 KB |
Output is correct |
12 |
Correct |
160 ms |
8124 KB |
Output is correct |
13 |
Correct |
90 ms |
8252 KB |
Output is correct |
14 |
Correct |
153 ms |
8380 KB |
Output is correct |
15 |
Correct |
1 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 |
- |