Submission #789701

#TimeUsernameProblemLanguageResultExecution timeMemory
789701FEDIKUSComparing Plants (IOI20_plants)C++17
0 / 100
1 ms308 KiB
#include "plants.h" #include<bits/stdc++.h> using namespace std; const int maxn=2e5+10; int n; int sled[maxn]; // 1 = veci int pref[maxn]; int uk=0; void init(int k, vector<int> r) { n=r.size(); for(int i=0;i<n;i++){ if(r[i]==1) sled[i]=1; if(i>0) pref[i]=pref[i-1]; pref[i]+=sled[i]; uk+=sled[i]; } return; } int qry(int l,int r){ return pref[r]-(l>0 ? pref[l-1]:0); } int compare_plants(int x, int y){ if(qry(x,y-1)==y-x) return -1; int ostalo=uk-qry(x,y-1); if(ostalo==n-y+x) 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...