Submission #1051351

#TimeUsernameProblemLanguageResultExecution timeMemory
1051351Gromp15Comparing Plants (IOI20_plants)C++17
0 / 100
30 ms3200 KiB
#include <bits/stdc++.h> #include "plants.h" #define sz(x) (int)x.size() using namespace std; int n; vector<int> ord; void init(int k, std::vector<int> r) { n = sz(r); ord.resize(n, -1); for (int i = 0; i < n; i++) { int mn = -1; for (int j = 0; j < n; j++) if (!~ord[j]) { if (!~mn || r[j] < r[mn]) mn = j; } if (!~mn) break; vector<bool> use(n); for (int j = 0; j < n; j++) if (r[j] == r[mn]) use[j] = 1; for (int j = 0; j < n; j++) if (!~ord[j] && use[j]) { ord[j] = n - i; for (int z = 1; z <= k-1; z++) { int idx = j - z; if (idx < 0) idx += n; r[idx]--; } } } } int compare_plants(int x, int y) { return ord[x] > ord[y] ? 1 : ord[x] == ord[y] ? 0 : -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...