Submission #1055989

#TimeUsernameProblemLanguageResultExecution timeMemory
1055989LittleOrangeComparing Plants (IOI20_plants)C++17
0 / 100
1 ms348 KiB
#include "plants.h" #include<bits/stdc++.h> using namespace std; using ll = int; namespace{ vector<ll> r,rk; ll n,k; } void init(int K, std::vector<int> R) { n = r.size(); k = K; r = R; rk.resize(n,-1); vector<ll> a = R; for(ll t = 0;t<n;t++){ vector<ll> zs; for(ll i = 0;i<n;i++) if(rk[i]==-1&&a[i]<=0) zs.push_back(i); ll zz = zs[0]; if(zs.size()>1){ if ((zs[0]-zs[1]+n)%n<=k-1)zz = zs[1]; } rk[zz] = t; for(ll i = 0;i<k;i++) a[(zz-i+n)%n]--; } } int compare_plants(int x, int y) { if (rk[x]<rk[y]) return 1; else 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...