답안 #604910

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
604910 2022-07-25T10:46:15 Z pakhomovee Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 3156 KB
#include <iostream>
#include <vector>
#include <random>
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iomanip>

using namespace std;

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    vector<double> a(n);
    vector<double> b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i] >> b[i];
    }
    sort(a.rbegin(), a.rend());
    sort(b.rbegin(), b.rend());
    double res = 0;
    double ans = 0;
    double sa = 0;
    for (int i = 0; i <= n; ++i) {
        double sb = 0;
        for (int j = 0; j <= n; ++j) {
            ans = max(ans, min(sa, sb) - i - j);
            if (j < n) {
                sb += b[j];
            }
        }
        if (i < n) {
            sa += a[i];
        }
    }
    cout << fixed << setprecision(4) << ans;
}

Compilation message

sure.cpp: In function 'int32_t main()':
sure.cpp:24:12: warning: unused variable 'res' [-Wunused-variable]
   24 |     double res = 0;
      |            ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 2 ms 360 KB Output is correct
14 Correct 3 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 3 ms 340 KB Output is correct
13 Correct 2 ms 360 KB Output is correct
14 Correct 3 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 2 ms 332 KB Output is correct
17 Execution timed out 2051 ms 3156 KB Time limit exceeded
18 Halted 0 ms 0 KB -