Submission #1043187

#TimeUsernameProblemLanguageResultExecution timeMemory
1043187thinknoexitComparing Plants (IOI20_plants)C++17
0 / 100
1 ms348 KiB
#include "plants.h" #include<bits/stdc++.h> using namespace std; using ll = long long; int n; int ord[5050]; void init(int k, vector<int> r) { n = r.size(); memset(ord, -1, sizeof ord); for (int i = 0;i < n;i++) { vector<int> v; for (int j = 0;j < n;j++) { if (ord[j] == -1 && r[j] == 0) { v.push_back(j); } } int idx = 0; for (int j = 0;j < (int)v.size();j++) { if ((v[j] - v[(j + n - 1) % n] + n) % n >= k) idx = v[j]; } ord[idx] = i; for (int j = 1;j < k;j++) { r[(idx - j + n) % n]--; } } } int compare_plants(int x, int y) { return (ord[x] > ord[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...