답안 #872561

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
872561 2023-11-13T11:21:00 Z vjudge1 Sure Bet (CEOI17_sure) C++17
20 / 100
56 ms 416 KB
//author: Ahmet Alp Orakci
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

#define ONLINE_JUDGE
void solve() {
    int n;
    cin >> n;

    pair <double, double> arr[n];
    for(int i = 0; i < n; i++) {
        cin >> arr[i].first >> arr[i].second;
    }

    double ans = 0;
    for(int mask = 0; mask < (1 << n); mask++) {
        for(int mmask = 0; mmask < (1 << n); mmask++) {
            double fir = 0, sec = 0;
            for(int i = 0; i < n; i++) {
                if(mask & (1 << i)) {
                    fir += arr[i].first;
                } 
                if(mmask & (1 << i)) {
                    sec += arr[i].second;
                }
            }

            ans = max(ans, min(fir, sec) - __builtin_popcount(mask) - __builtin_popcount(mmask));
        }
    }

    printf("%.4lf", double(ans));
    
    return;
}

signed main() {
    #ifndef ONLINE_JUDGE
        freopen(".in", "r", stdin);
        freopen(".out", "w", stdout);
    #endif

    int t = 1; //cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 54 ms 412 KB Output is correct
4 Correct 54 ms 348 KB Output is correct
5 Correct 54 ms 412 KB Output is correct
6 Correct 56 ms 416 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 54 ms 412 KB Output is correct
4 Correct 54 ms 348 KB Output is correct
5 Correct 54 ms 412 KB Output is correct
6 Correct 56 ms 416 KB Output is correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 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 54 ms 412 KB Output is correct
4 Correct 54 ms 348 KB Output is correct
5 Correct 54 ms 412 KB Output is correct
6 Correct 56 ms 416 KB Output is correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Halted 0 ms 0 KB -