이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
int n, k;
vector<int> a;
int compare_plants(int x, int y) {
if(x==n-1) {
if(y==x-1) {
if(!a[y])
return -1;
return 1;
} else {
if(y!=0)
return 0;
if(!a[x])
return 1;
return -1;
}
} else {
if(x==0) {
if(y==n-1) {
if(!a[y])
return -1;
return 1;
} else {
if(y!=1)
return 0;
if(!a[x])
return 1;
return -1;
}
} else {
if(abs(x-y)!=1)
return 0;
if(x<y) {
if(!a[x])
return 1;
return -1;
} else {
if(!a[y])
return -1;
return 1;
}
}
}
}
void init(int K, vector<int> r) {
n=(int)r.size(), k=K, a=r;
}
/*int main() {
init(2, {0, 1, 0, 1});
cout << compare_plants(1, 2);
return 0;
}*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |