Submission #965655

#TimeUsernameProblemLanguageResultExecution timeMemory
96565512345678Let's Win the Election (JOI22_ho_t3)C++17
10 / 100
10 ms600 KiB
#include <bits/stdc++.h> using namespace std; const int nx=505; #define int long double int n, k; vector<pair<int, int>> v; int cost, res=LDBL_MAX; int32_t main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n>>k; v.resize(n); for (int i=0; i<n; i++) { cin>>v[i].second>>v[i].first; v[i].second=-v[i].second; if (v[i].first==-1) v[i].first=1e9; } sort(v.begin(), v.end()); for (int i=0; i<k; i++) { vector<int> t; for (int j=i; j<n; j++) t.push_back(-v[j].second); sort(t.begin(), t.end()); int tmp=cost; //cout<<tmp<<'\n'; for (int j=0; j<k-i; j++) tmp+=(t[j])/(1+i); //cout<<i<<' '<<tmp<<'\n'; res=min(res, tmp); cost+=(v[i].first)/(1+i); } cout<<fixed<<setprecision(12)<<res; }
#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...