Submission #541823

#TimeUsernameProblemLanguageResultExecution timeMemory
541823LucaDantasComparing Plants (IOI20_plants)C++17
14 / 100
4070 ms8840 KiB
#include "plants.h" #include <bits/stdc++.h> using namespace std; constexpr int maxn = 2e5+10; int ordem[maxn]; void init(int k, std::vector<int> r) { int n = (int)(r.size()); for(int i = 0; i < n; i++) { int mx = 0; for(int j = 1; j < n; j++) if(r[j] < r[mx] || (r[j] == r[mx] && (mx - j + n) < k)) mx = j; ordem[mx] = i; r[mx] = 0x3f3f3f3f; for(int j = 0; j < k; j++) --r[(mx - j + n) % n]; } } int compare_plants(int x, int y) { return ordem[x] < ordem[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...