Submission #1016351

#TimeUsernameProblemLanguageResultExecution timeMemory
1016351UnforgettableplComparing Plants (IOI20_plants)C++17
14 / 100
4035 ms8668 KiB
#include <bits/stdc++.h> using namespace std; vector<int> h; void init(int k, std::vector<int> r) { int n = r.size(); h.resize(n); vector<bool> taken(n); for(int ht=n;ht;ht--){ for(int i=0;i<n;i++){ if(r[i]!=0)continue; bool works = true; int j=i; for(int len=1;len<k;len++){ j=(j-1+n)%n; if(r[j]==0)works=false; } if(works){ h[i]=ht; int j=i; for(int len=1;len<k;len++){ j=(j-1+n)%n; r[j]--; } r[i] = n+1; break; } else { i+=k-1; } } } } int compare_plants(int x, int y) { if(h[x]>h[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...