답안 #848877

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
848877 2023-09-13T16:16:15 Z sandry24 Sure Bet (CEOI17_sure) C++17
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define pb push_back
#define mp make_pair
#define f first
#define s second
 
void solve(){
    int n;
    cin >> n;
    vector<float> a(n), b(n);
    for(int i = 0; i < n; i++)
        cin >> a[i] >> b[i];
    sort(a.begin(), a.end(), greater<float>());
    sort(b.begin(), b.end(), greater<float>());
    double total_a = 0, total_b = 0, total_max = 0;
    for(int i = 0; i < n; i++){
        total_a += a[i] - 1;
        total_b = 0;
        total_max = max(total_max, min(total_a, total_b - (i+1)));
        //cout << total_a << ' ' << -(i+1) << '\n';
        for(int j = 0; j < n; j++){
            total_b += b[j] - 1;
            total_max = max(total_max, min(total_a - (j+1), total_b - (i+1)));
            //cout << total_a - (j+1) << ' ' << total_b - (i+1) <<  ' ' << total_b << '\n';
        }
    }
    cout << total_max << '\n';
}
 
int main(){
    //freopen("flota.in", "r", stdin);
    //freopen("flota.out", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -