답안 #854639

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
854639 2023-09-28T09:34:55 Z anhphant Sure Bet (CEOI17_sure) C++14
60 / 100
2000 ms 4948 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ldb;
#define endl '\n'

ll N;
ldb A[100007], B[100007];

void initialize() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    if (fopen("FILE.INP", "r")) {
        freopen("FILE.INP", "r", stdin);
        freopen("FILE.OUT", "w", stdout);
    }

    cin >> N;
    for(int i = 1; i <= N; ++i) cin >> A[i] >> B[i];

    sort(A + 1, A + 1 + N, greater<ldb>());
    sort(B + 1, B + 1 + N, greater<ldb>());

    /*for(int i = 1; i <= N; ++i) {
        cerr << A[i] << " " << B[i] << endl;
    }*/
}

namespace subtask2 {
    void solve() {
        ldb sum1 = 0;
        ldb ans = 0;
        for(int i = 0; i <= N; ++i) {
            sum1 += A[i];
            ldb sum2 = 0;
            for(int j = 0; j <= N; ++j) {
                sum2 += B[j];
                ans = max(ans, min(sum1 - ldb(i + j), sum2 - ldb(i + j)));

                //cerr << i << " " << j << " " << i + j << endl;
                //cerr << setprecision(4) << sum1 << " " << sum2 << " " <<
                //sum1 - ldb(i + j) << " " << sum2 - ldb(i + j) << endl;
            }
        }

        cout << fixed << setprecision(4) << ans;
    }

    void process() {
        solve();
    }
}

int main() {
    initialize();
    subtask2 :: process();
}

Compilation message

sure.cpp: In function 'void initialize()':
sure.cpp:14:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |         freopen("FILE.INP", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sure.cpp:15:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         freopen("FILE.OUT", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 4 ms 2528 KB Output is correct
13 Correct 5 ms 2564 KB Output is correct
14 Correct 5 ms 2396 KB Output is correct
15 Correct 5 ms 2396 KB Output is correct
16 Correct 5 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 1 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 1 ms 2396 KB Output is correct
10 Correct 1 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 4 ms 2528 KB Output is correct
13 Correct 5 ms 2564 KB Output is correct
14 Correct 5 ms 2396 KB Output is correct
15 Correct 5 ms 2396 KB Output is correct
16 Correct 5 ms 2392 KB Output is correct
17 Execution timed out 2036 ms 4948 KB Time limit exceeded
18 Halted 0 ms 0 KB -