This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |