이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
typedef pair<ll,ll> pii;
const ll MAXN = 2e5+5;
const ll INF = 1e9+7;
ll presum[MAXN],n;
void init(int k, std::vector<int> r) {
ll i;
n=(ll)r.size();
presum[0]=0;
for(i=1;i<=n;i++){
presum[i]=presum[i-1]+r[i-1];
}
return;
}
int compare_plants(int x, int y) {
x++; y++;
ll k = presum[y-1]-presum[x-1];
// cout<<"first"<<k<<"\n";
if(k==0){return 1; }
if(k==y-x){return -1; }
k = presum[n]-presum[y-1];
k += presum[x-1];
// cout<<"second "<<k<<endl;
if(k==0){return -1; }
if(k==n-(y-x)){return 1; }
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... |