Submission #1041372

#TimeUsernameProblemLanguageResultExecution timeMemory
1041372vjudge1Comparing Plants (IOI20_plants)C++17
5 / 100
177 ms16620 KiB
#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)

plants.cpp: In function 'void init(int, std::vector<int>)':
plants.cpp:8:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    8 |     for(int i=0;i<n;i++)
      |     ^~~
plants.cpp:12:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   12 |  return;
      |  ^~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...