#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define si unordered_set<int>
#define vi vector<int>
int di[200];
int ri[200];
void init(int k, vi r) {
int x=0;
int n = r.size();
for (int i=n-1; i>=0; i--) {
if (r[i] != r[n-1]) {
x = i+1;
break;
}
}
int curr = x;
for (int i=x+n-1; i>=x; i--) {
if (r[i%n] == r[curr]) {
curr = (i+1) %n;
}
di[i%n] = curr;
ri[i%n] = r[i%n];
}
}
int compare_plants(int x, int y) {
int a = min(x, y), b = max(x, y), out=-1;
if (di[a] >= b || di[a] < a) {
out = 1-ri[a];
}
else if (di[b] < b && di[b] >=a) {
out = ri[b];
}
if (out == -1) {
return 0;
}
if (y==a) {
out = 1-out;
}
if (out == 0) {
out --;
}
return out;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
45 ms |
4204 KB |
Output is correct |
7 |
Runtime error |
30 ms |
7592 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Incorrect |
0 ms |
304 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
45 ms |
4204 KB |
Output is correct |
7 |
Runtime error |
30 ms |
7592 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |