Submission #806147

#TimeUsernameProblemLanguageResultExecution timeMemory
806147vjudge1Let's Win the Election (JOI22_ho_t3)C++14
5 / 100
1 ms340 KiB
#include<bits/stdc++.h> #define fi first #define se second #define ll long long #define ld long double using namespace std ; const int N = 500 ; bool flag1, flag2 ; int n, k ; pair<pair<ld, ld>, int> p[N + 1] ; signed main() { ios_base::sync_with_stdio( 0 ) ; cin.tie( 0 ) ; cout.tie( 0 ) ; cin >> n ; cin >> k ; for(int i = 1 ; i <= n ; i++) { cin >> p[i].fi.fi >> p[i].fi.se ; p[i].se = i ; // cout << i << ' ' << flag1 << '\n' ; if(p[i].fi.se != -1) flag1 = 1 ; if(p[i].fi.se != -1 && p[i].fi.se != p[i].fi.fi) flag2 = 1 ; } if(!flag1) { sort(p + 1, p + n + 1) ; ld ans = 0 ; for(int i = 1 ; i <= k ; i++) ans += p[i].fi.fi ; cout << fixed << setprecision(9) << ans ; return 0 ; } 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...