Submission #528632

#TimeUsernameProblemLanguageResultExecution timeMemory
528632PlurmComparing Plants (IOI20_plants)C++11
0 / 100
37 ms5224 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; vector<int> h; // recovered void init(int k, vector<int> r) { int n = r.size(); h.resize(n, 0); for (int it = 0; it < n; it++) { int m = -1; int l = -1; for (int i = 0; i < n; i++) { if (r[i] == 0) { if (m == -1) m = i; else if (i - l > k) m = i; l = i; } } // printf("DBG %d\n", m); h[m] = n - it; for (int i = 0; i < k; i++) { r[(m + n - i) % n]--; } } } int compare_plants(int x, int y) { return h[x] > h[y] ? 1 : -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...