Submission #991636

#TimeUsernameProblemLanguageResultExecution timeMemory
991636OtalpLet's Win the Election (JOI22_ho_t3)C++14
5 / 100
15 ms2648 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define int ll #define pii pair<int, int> #define ff first #define ss second #define ld long double #define pb push_back pair<ld, ld> a[300100]; ll b[300100]; ll n, m; bool cmp(int x, int y){ return a[x].ss < a[y].ss; } void solve(){ cin>>n>>m; int cnt = 0; vector<int> q; for(int i=1; i<=n; i++){ cin>>a[i].ff>>a[i].ss; if(a[i].ss == -1) a[i].ss = 1e9; else cnt ++, q.pb(i); } sort(q.begin(), q.end(), cmp); sort(a + 1, a + 1 + n); ld ans = 1e18; for(int d=0; d<=cnt; d++){ ld res = 0; map<int, int> us; for(int i=0; i<d; i++){ us[q[i]] = 1; res += a[q[i]].ss / (i + 1); } for(int i=1; us.size() < m; i++){ if(!us[i]) res += a[i].ff / (d + 1), us[i] = 1; } //cout<<d<<' '<<res<<'\n'; ans = min(ans, res); } cout<<fixed<<setprecision(9)<<ans<<'\n'; } signed main(){ solve(); }

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:39:32: warning: comparison of integer expressions of different signedness: 'std::map<long long int, long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   39 |         for(int i=1; us.size() < m; i++){
      |                      ~~~~~~~~~~^~~
#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...