답안 #878620

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
878620 2023-11-25T02:18:18 Z Faisal_Saqib Sure Bet (CEOI17_sure) C++17
0 / 100
0 ms 348 KB
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
#define int long long
const int N=1001;
long long p3[N];
signed main()
{
    cout<<fixed<<setprecision(4);
	int n;
	cin>>n;
	p3[0]=1;
	for(int i=1;i<=n;i++)
		p3[i]=(p3[i-1]*3ll);
	vector<double> a,b;
	for(int i=0;i<n;i++)
	{
		double x,y;
		cin>>x>>y;
		a.push_back(x);
		b.push_back(y);
	}
	double ans=0;
	for(long long mask=0;mask<p3[n];mask++)
	{
		double s1=0,s2=0;
		double p=(double)n;
		long long cur=mask;
		for(int j=0;j<n;j++)
		{
			if(cur%3==2)
				s1+=a[j];
			else if(cur%3)
				s2+=b[j];
			else
				p--;
			cur/=3;
		}
		ans=max(ans,min(s1,s2)-p);
	}
	cout<<ans<<endl;
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -