# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
431382 | Rouge_Hugo | Comparing Plants (IOI20_plants) | C++14 | 1 ms | 352 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "plants.h"
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
const int N=200090;
int r[N];
int n;
void init(int k, vector<int> R) {
n=R.size();
for(int i=0;i<n;i++)r[i]=R[i];
if(r[0]==0)r[0]=-1;
for(int i=1;i<n;i++)
{
r[i]+=r[i-1];
}
}
int compare_plants(int x, int y) {
int z=0;
if(x>0)z=r[x-1];
int one=r[y-1]-z;
int two=z+r[n-1]-r[y-1];
if(abs(one)==abs(y-x))
{
if(one==y-x)return 1;
return -1;
}
# | 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... |