Submission #932611

#TimeUsernameProblemLanguageResultExecution timeMemory
932611EJIC_B_KEDAXComparing Plants (IOI20_plants)C++17
14 / 100
4102 ms5684 KiB
#include <bits/stdc++.h> using ll = long long; using namespace std; const int N = 200200; int level[N]; void init(int k, vector<int> r) { int n = r.size(); int ok = 0, last, lev = n, iter = 0; while (ok < n) { last = -k; for (int i = n - 1; i > n - k; i--) { if (!r[i]) { last = i - n; break; } } vector<int> nw = r; for (int i = 0; i < n; i++) { if (!r[i]) { if (i - last >= k) { level[i] = lev; ok++; for (int j = i - 1; j > i - k; j--) { if (j >= 0) { nw[j]--; } else { nw[j + n]--; } } nw[i] = INT32_MAX / 2; } last = i; } } swap(nw, r); lev--; iter++; assert(iter < n + 10); } } int compare_plants(int x, int y) { if (level[x] < level[y]) { return -1; } return level[x] > level[y]; }
#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...