# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
388020 | Supersonic | Comparing Plants (IOI20_plants) | C++17 | 758 ms | 11352 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;
int a[400001];int b[400001];int n;
void init(int k, std::vector<int> r) {
if(k==2){
n=r.size();
for(int i=0;i<n;i++)r.push_back(r[i]);
for(int i=0;i<2*n;i++)b[i]=r[i];
a[0]=0;
for(int i=1;i<2*n;i++){if(r[i]==r[i-1])a[i]=a[i-1];else a[i]=a[i-1]+1;}
}
return;
}
int compare_plants(int x, int y) {
//cerr<<x<<' '<<y<<endl;
if(x>y)y+=n;y--;
if(a[x]==a[y]){
//cerr<<b.size()<<endl;
if(b[x]==0)return 1;
else return -1;
}
cerr<<x<<' '<<y<<endl;
y++;y%=n;if(y>x)x+=n;x--;
if(a[x]==a[y]){
//cerr<<b.size()<<endl;
if(b[y]==0)return -1;
else 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... |