Submission #427670

#TimeUsernameProblemLanguageResultExecution timeMemory
427670lakshith_Comparing Plants (IOI20_plants)C++14
0 / 100
1 ms256 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; vector<int> r; int n; void init(int k, std::vector<int> R) { assert(k==2); r=R; n = R.size(); return; } int compare_plants(int x, int y) { if(x>y){ swap(x,y); int one=0,zero=0; for(int i=x;i<y;i++){ if(r[i]==1)one++; else zero++; } if(zero==0)return -1; else if(one==0)return 1; return 0; } int one=0,zero=0; for(int i=x;i<y;i++){ if(r[i]==1)one++; else zero++; } if(zero==0)return 1; else if(one==0)return -1; return 0; }
#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...