답안 #1027261

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1027261 2024-07-19T02:56:22 Z vjudge1 Sure Bet (CEOI17_sure) C++14
60 / 100
2000 ms 3528 KB
#include <iostream>
#include <vector>
#include <algorithm>
#pragma GCC optimize("03,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

using namespace std;

int main()
{
    int n;
    scanf("%d", &n);
    vector<double> a(n), b(n);
    for(int i = 0; i < n; ++i)
        scanf("%lf %lf", &a[i], &b[i]);

    sort(a.begin(), a.end(), greater<double>());
    sort(b.begin(), b.end(), greater<double>());

    vector<double> sum_a(n + 1, 0), sum_b(n + 1, 0);

    for(int i = 0; i < n; ++i)
    {
        sum_a[i + 1] = sum_a[i] + a[i] - 1;
        sum_b[i + 1] = sum_b[i] + b[i] - 1;
    }

    double ans = -1e9;
    for(int na = 0; na <= n; ++na)
    {
        for(int nb = 0; nb <= n; ++nb)
        {
            double cur = min(sum_a[na] - nb, sum_b[nb] - na);
            ans = max(cur, ans);
        }
    }
    printf("%.4lf",(double)ans);
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
sure.cpp:15:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |         scanf("%lf %lf", &a[i], &b[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 2 ms 348 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 2 ms 344 KB Output is correct
17 Execution timed out 2089 ms 3528 KB Time limit exceeded
18 Halted 0 ms 0 KB -