| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1348627 | Faisal_Saqib | Comparing Plants (IOI20_plants) | C++17 | 0 ms | 344 KiB |
#include "plants.h"
#include <bits/stdc++.h>
using namespace std;
const int N=2e5+10;
int n;
int pre[N];
void init(int k, std::vector<int> r) {
n=r.size();
for(int i=0;i<n;i++)
{
pre[i+1]=pre[i]+r[i];
}
return;
}
int check(int x,int y)
{
if(x>y)
{
return -1*check(y,x);
}
int sm=pre[y]-pre[x];
if(sm==0)
{
return -1;
}
else if(sm==(y-x))
{
return +1;
}
if(pre[n]-sm == x+n-y)
{
return +1;
}
else if(pre[n]==sm)
{
return -1;
}
return 0;
}
int compare_plants(int x, int y) {
return check(x,y);
}
| # | 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... | ||||
