Submission #965624

#TimeUsernameProblemLanguageResultExecution timeMemory
96562412345678Let's Win the Election (JOI22_ho_t3)C++17
10 / 100
11 ms612 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=DBL_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; if (v[i].first==-1) v[i].first=1e9; } sort(v.begin(), v.end()); for (int i=0; i<n; 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...