# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1073839 | tolbi | Comparing Plants (IOI20_plants) | C++17 | 1 ms | 348 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 <set>
std::vector<int> r;
std::set<int> st;
void init(int k, std::vector<int> r) {
::r=r;
for (int i = 0; i < r.size(); i++){
if (r[i]!=r[(i+r.size()-1)%r.size()]){
st.insert(i);
}
}
}
int compare_plants(int x, int y) {
if (st.lower_bound(x+1)==st.end() || *st.lower_bound(x+1)>y){
return r[x]?1:-1;
}
if (st.lower_bound(y+1)==st.end() && *st.begin()>x){
return r[y]?-1: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... |