Submission #1027352

# Submission time Handle Problem Language Result Execution time Memory
1027352 2024-07-19T03:59:46 Z vjudge1 Sure Bet (CEOI17_sure) C++17
60 / 100
2000 ms 3412 KB
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
#include <stdio.h>
#include <algorithm>
#include <functional>
int main() {
    int n; scanf("%d", &n);
    double a[n], b[n];
    for (int i = 0; i < n; i++) scanf("%lf %lf", &a[i], &b[i]), a[i] -= 1, b[i] -= 1;
    std::sort(a, a + n, std::greater<double>());
    std::sort(b, b + n, std::greater<double>());

    double pa[n], pb[n];
    pa[0] = a[0], pb[0] = b[0];
    for (int i = 1; i < n; ++i) pa[i] = pa[i - 1] + a[i], pb[i] = pb[i - 1] + b[i];
    
    double res = 0;
    for (int na = 1; na <= n; ++na)
        for (int nb = 1; nb <= n; ++nb) {
            res = std::max(res, std::min(pa[na - 1] - nb, pb[nb - 1] - na));
        }
    printf("%.4lf", res);
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:8:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     int n; scanf("%d", &n);
      |            ~~~~~^~~~~~~~~~
sure.cpp:10:38: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     for (int i = 0; i < n; i++) scanf("%lf %lf", &a[i], &b[i]), a[i] -= 1, b[i] -= 1;
      |                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory 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 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Execution timed out 2060 ms 3412 KB Time limit exceeded
18 Halted 0 ms 0 KB -