# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
421301 | JUANDI321 | Comparing Plants (IOI20_plants) | C++17 | 1 ms | 204 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 <vector>
#include <iostream>
using namespace std;
int sumpf[200010];
void init(int k, vector<int> r)
{
sumpf[0] = 200010;
for(int i = 1; i<r.size(); i++)
{
sumpf[i]=sumpf[i-1]+r[i];
if(r[i]==0)sumpf[i]--;
}
return;
}
int compare_plants(int x, int y) {
int dis = y-x-1;
if(sumpf[y]-sumpf[x-1] == dis)return 1;
if(sumpf[y]-sumpf[x-1] == -1*dis)return -1;
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... |