이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
#define what_is(a) cout << #a << " is " << a << "\n"
vector<int> r;
int n;
void init(int k, std::vector<int> R) {
assert(k==2);
r=R;
n = R.size();
return;
}
int compare_plants(int x, int y) {
int b = 1;
if(x>y){
swap(x,y);
b=-1;
}
int one=0,zero=0;
int p=x;
for(int i=0;i<abs(x-y);i++){
if(r[p]==1)one++;
else zero++;
p++;
if(p==n)p=0;
}
//what_is(one);
//what_is(zero);
if(zero==0)return -1*b;
else if(one==0)return 1*b;
p=y,one=0,zero=0;
for(int i=0;i<n-y+x;i++){
if(r[p]==1)one++;
else zero++;
p++;
if(p==n)p=0;
}
//what_is(one);
//what_is(zero);
if(zero==0)return 1*b;
else if(one==0)return -1*b;
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... |