답안 #859952

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
859952 2023-10-11T08:44:31 Z StefanSebez Let's Win the Election (JOI22_ho_t3) C++14
10 / 100
27 ms 520 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int inf=1e9;
int main()
{
    int n,k;cin>>n>>k;
    pair<int,int>a[n+1];
    multiset<pair<int,int> >st1,st2;
    for(int i=1;i<=n;i++)
	{
		cin>>a[i].se>>a[i].fi;
		if(a[i].fi!=-1)st1.insert(a[i]);
		st2.insert({a[i].se,a[i].fi});
	}
    sort(a+1,a+n+1);
    long double res=inf;
    for(int j=0;j<=k;j++)
	{
		int K=k,J=j;
		long double sum=0,c=1;
		multiset<pair<int,int> >ST1,ST2;
		ST1=st1;
		ST2=st2;
		while(!ST1.empty() && J>0)
		{
			pair<int,int>x=*ST1.begin();
			if(x.fi!=-1)
			{
				sum+=(long double)x.fi/c;
				c++;
				J--;
				K--;
				ST2.erase(ST2.find({x.se,x.fi}));
			}
			ST1.erase(ST1.find(x));
		}
		while(!ST2.empty() && K>0)
		{
			pair<int,int>x=*ST2.begin();
			sum+=(long double)x.fi/c;
			if(x.fi==x.se) c++;
			K--;
			ST2.erase(ST2.find(x));
		}
		if(res>sum)
		{
			res=sum;
		}
	}
	cout<<setprecision(9)<<fixed;
	cout<<res;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 8 ms 348 KB Output is correct
9 Correct 12 ms 480 KB Output is correct
10 Correct 7 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 8 ms 348 KB Output is correct
9 Correct 12 ms 480 KB Output is correct
10 Correct 7 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 520 KB Output is correct
13 Correct 4 ms 348 KB Output is correct
14 Correct 3 ms 488 KB Output is correct
15 Correct 13 ms 516 KB Output is correct
16 Correct 12 ms 348 KB Output is correct
17 Correct 9 ms 348 KB Output is correct
18 Correct 27 ms 508 KB Output is correct
19 Correct 20 ms 348 KB Output is correct
20 Correct 14 ms 484 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 344 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 344 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Incorrect 0 ms 344 KB Output isn't correct
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 24 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 4 ms 348 KB Output is correct
8 Correct 8 ms 348 KB Output is correct
9 Correct 12 ms 480 KB Output is correct
10 Correct 7 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 4 ms 520 KB Output is correct
13 Correct 4 ms 348 KB Output is correct
14 Correct 3 ms 488 KB Output is correct
15 Correct 13 ms 516 KB Output is correct
16 Correct 12 ms 348 KB Output is correct
17 Correct 9 ms 348 KB Output is correct
18 Correct 27 ms 508 KB Output is correct
19 Correct 20 ms 348 KB Output is correct
20 Correct 14 ms 484 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Incorrect 0 ms 344 KB Output isn't correct
30 Halted 0 ms 0 KB -