| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 434588 | pere_gil | 식물 비교 (IOI20_plants) | C++17 | 120 ms | 6104 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"
using namespace std;
vector<int> v;
vector<int> acc;
int tam;
void init(int k, std::vector<int> r) {
	v=r;
	tam=k;
	acc.push_back(v[0]);
	for(int i=1;i<v.size();i++)
		acc.push_back(acc[i-1]+v[i]);
	
	return;
}
bool op1(int l, int r){
	int aux;
	if(l<r){
		aux=acc[r-1];
		aux-=(l==0) ? 0 : acc[l-1];
		return aux==(r-l);
	}
	aux=acc.back()-acc[l-1];
	aux+=(r==0) ? 0 : acc[r-1];
	return aux==(acc.size()-l+r);
}
bool op2(int l, int r){
	int aux;
	if(l<r){
		aux=acc[r-1];
		aux-=(l==0) ? 0 : acc[l-1];
		return !aux;
	}
	aux=acc.back()-acc[l-1];
	aux+=(r==0) ? 0 : acc[r-1];
	return !aux;
}
int compare_plants(int x, int y) {
	if(op1(x,y) || op2(y,x)) return -1;
	if(op1(y,x) || op2(x,y)) return 1;
	return 0;
	
	return 0;
}
Compilation message (stderr)
| # | 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... | ||||
