답안 #848898

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
848898 2023-09-13T16:42:06 Z sandry24 Sure Bet (CEOI17_sure) C++17
20 / 100
1 ms 348 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_b += b[i];
        total_max = max(total_max, min(total_a - (i+1), total_b - (i+1)));
    }
    total_b = 0;
    for(int i = 0; i < n; i++){
        total_a += a[i];
        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];
            total_max = max(total_max, min(total_a - (j+i+2), total_b - (j+i+2)));
            //cout << total_a - (j+i+2) << ' ' << total_b - (j+i+2) <<  ' ' << total_b << '\n';
        }
    }
    cout << fixed << setprecision(4) << 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 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Incorrect 0 ms 344 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Incorrect 0 ms 344 KB Output isn't correct
12 Halted 0 ms 0 KB -