제출 #428919

#제출 시각아이디문제언어결과실행 시간메모리
428919Keshi식물 비교 (IOI20_plants)C++17
14 / 100
4065 ms5964 KiB
//In the name of God #include <bits/stdc++.h> #include "plants.h" using namespace std; typedef int ll; typedef pair<ll, ll> pll; const ll maxn = 2e5 + 100; const ll mod = 1e9 + 7; const ll inf = 1e9; #define fast_io ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define Mp make_pair #define F first #define S second #define pb push_back #define all(x) (x).begin(), (x).end() #define Sz(x) ll((x).size()) #define lc (id << 1) #define rc (lc | 1) ll n, k, a[maxn], b[maxn]; void init(int K, vector<int> R){ k = K; n = Sz(R); for(ll i = 0; i < n; i++){ a[i] = R[i]; } for(ll i = n; i--;){ ll mn = inf; for(ll j = 0; j < n; j++){ mn = min(mn, a[j]); } vector<ll> vec; for(ll j = 0; j < n; j++){ if(mn == a[j]) vec.pb(j); } ll x = vec[0]; for(ll j = 0; j + 1 < Sz(vec); j++){ if(vec[j + 1] - vec[j] >= k) x = vec[j + 1]; } b[x] = i; a[x] += inf; ll y = x - k + 1; if(y < 0) y += n; while(y != x){ a[y++]--; if(y == n) y = 0; } } return; } int compare_plants(int x, int y){ if(b[x] > b[y]) return 1; return -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...