# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1041372 | vjudge1 | Comparing Plants (IOI20_plants) | C++17 | 177 ms | 16620 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;
set<int> zero,one;
int n;
void init(int k, std::vector<int> r) {
n=r.size();
for(int i=0;i<n;i++)
if(r[i])
one.insert(i);
else zero.insert(i);
return;
}
bool noone(int x,int y){
if(x>y) return noone(x,n)&&noone(0,y);
return one.lower_bound(x)==one.lower_bound(y);
}
bool nozero(int x,int y){
if(x>y) return nozero(x,n)&&nozero(0,y);
return zero.lower_bound(x)==zero.lower_bound(y);
}
int compare_plants(int x, int y) {
if(noone(x,y)) return 1;
if(nozero(x,y)) return -1;
if(noone(y,x)) return -1;
if(nozero(y,x)) 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... |