Submission #984070

#TimeUsernameProblemLanguageResultExecution timeMemory
984070phoenix0423Comparing Plants (IOI20_plants)C++17
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; #define pb push_back #define eb emplace_back const int maxn = 2e5 + 5; const int INF = 1e9; #include "plants.h" int rk[maxn]; int n, k; vector<int> r; void init(int _k, std::vector<int> _r) { r = _r, k = _k; n = r.size(); for(auto x : _r) r.pb(x); auto del = [&](int x) -> void { for(int i = max(0, x - k + 1); i < x; i++) r[i] --; x += n; for(int i = x - k + 1; i < x; i++) r[i] --; }; for(int rd = 0; rd < n; rd++){ int csc = 0; for(int i = 0; i < 2 * n; i++){ if(r[i] == 0){ if(csc >= n - k){ cout<<"ok : "<<i<<"\n"; del(i % n); rk[i % n] = rd; r[i] = r[(i + n) % (2 * n)] = INF; break; } csc = 0; } else csc++; } } return; } int compare_plants(int x, int y) {\ return rk[x] < rk[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...