제출 #1357972

#제출 시각아이디문제언어결과실행 시간메모리
1357972tullSure Bet (CEOI17_sure)C++20
20 / 100
41 ms432 KiB
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define all(A) A.begin(),A.end()
#define bp '\n'
#define vp cout<<'\n';
const int N=2e5+5;
signed main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    int n;
    cin>>n;
    vector<pair<double,double>>a(n);
    double ans=-1e18;
    for(int i=0;i<n;++i){
        cin>>a[i].first>>a[i].second;
    }
    for(int i=0;i<(1<<n);++i){
        for(int j=0;j<(1<<n);++j){
            double s1=0,s2=0,sel=0;
            for(int k=0;k<n;++k){
                if(i&(1<<k)){
                    s1+=a[k].first;
                    ++sel;
                }
                if(j&(1<<k)){
                    s2+=a[k].second;
                    ++sel;
                }
            }
            //cout<<s1<<' '<<s2<<bp;
            ans=max(ans,min(s1,s2)-sel);
        }
    }
    cout<<fixed<<setprecision(4)<<ans;
}
/*
5 9 7
...##....
..#.##..#
..#....##
.##...#..
....#....
WSEE

*/
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…