Submission #1023153

#TimeUsernameProblemLanguageResultExecution timeMemory
1023153Mr_PhComparing Plants (IOI20_plants)C++17
0 / 100
1 ms600 KiB
#include "plants.h" #include <bits/stdc++.h> // #include "grader.cpp" using namespace std; vector<int>pref; int N; int get(int l,int r) { if(l<=r) return pref[r]-(l?pref[l-1]:0); else return pref[N-1]-pref[r-1]+(l?pref[l-1]:0); } void init(int k, std::vector<int> r) { N=r.size(); pref.resize(N); pref[0]=r[0]; for(int i=1;i<N;i++) pref[i]=pref[i-1]+r[i]; } int compare_plants(int x, int y) { int l=x,r=y-1; int l1=(x==0?N-1:x-1),r1=y; if(get(l,r)==0)return 1; if(get(l1,r1)==(abs(l1-r1)+1))return 1; if(get(l,r)==(r-l)+1)return -1; if(get(l1,r1)==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...