Submission #830129

#TimeUsernameProblemLanguageResultExecution timeMemory
830129BaytoroComparing Plants (IOI20_plants)C++17
14 / 100
4064 ms8708 KiB
#include "plants.h" //#include "grader.cpp" #include <bits/stdc++.h> #define pb push_back #define fr first #define sc second using namespace std; const int N=2e5+5; int ans[N]; void init(int k, vector<int> r) { int n=r.size(); for(int t=n-1;t>=0;t--){ vector<int> a; for(int i=0;i<n;i++) if(r[i]==0) a.pb(i); int v=0; for(int i=0;i<(int)a.size();i++){ if(i==0){ if(a[i]-(a.back()-n)>=k){ v=a[i]; break; } } else{ if(a[i]-a[i-1]>=k){ v=a[i]; break; } } } for(int i=v-k+1;i<=v;i++){ if(r[(i+n)%n]!=-1) r[(i+n)%n]--; } r[v]=-1; ans[v]=t; } } int compare_plants(int x, int y) { if(ans[x]>ans[y]) return 1; else return -1; }
#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...