Submission #334165

#TimeUsernameProblemLanguageResultExecution timeMemory
334165rocks03Comparing Plants (IOI20_plants)C++14
14 / 100
4029 ms8684 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define pb push_back #define SZ(x) ((int)(x).size()) #define all(x) x.begin(), x.end() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); vector<int> plant; void init(int k, vector<int> r){ int N = SZ(r); plant.resize(N); for(int p = N-1; p >= 0; p--){ for(int i = 0; i < N; i++){ if(r[i] == 0){ int id = i; for(i = i + k; ; i++){ if(r[i % N] == 0){ id = i % N; break; } } plant[id] = p; r[id] = -1; for(int i = id - 1; i >= id - (k - 1); i--){ r[(i + N) % N]--; } } } } } int compare_plants(int x, int y) { if(plant[x] > plant[y]) return 1; else if(plant[x] < plant[y]) return -1; else 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...