# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
817837 | rubdary | Comparing Plants (IOI20_plants) | C++14 | 1 ms | 304 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 <iostream>
using namespace std;
vector <bool> plants;
void init(int k, vector<int> r) {
for(int i = 0; i < r.size(); i++){
if(r[i] == 0)
plants.push_back(true);
else
plants.push_back(false);
}
return;
}
int compare_plants(int x, int y) {
int i = x;
bool s = plants[x];
bool res = true;
while(i != y){
if(plants[i] != s) res = false;
i++;
i = i % plants.size();
}
if(res == true && s == true) return 1;
if(res == true && s == false) return -1;
res = true;
i = y;
s = plants[y];
while(i != x){
if(plants[i] != s) res = false;
i++;
i = i % plants.size();
}
if(res == true && s == true) return 1;
if(res == true && s == false) 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... |