답안 #56081

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
56081 2018-07-09T21:36:30 Z gabrielsimoes Sure Bet (CEOI17_sure) C++17
20 / 100
2000 ms 568 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const int MAXN = 1e5+10;

int n;
double pa[MAXN], pb[MAXN];

double ans = 0;
void dfs(int i, double a, double b) {
    // printf("i %d a %lf b %lf\n", i, a, b);
    if (i == n) {
        ans = max(ans, min(a, b));
    } else {
        dfs(i+1, a, b);
        dfs(i+1, a-1.0, b+pb[i]-1.0);
        dfs(i+1, a+pa[i]-1.0, b-1.0);
        dfs(i+1, a+pa[i]-2.0, b+pb[i]-2.0);
    }
}

int main() {
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        double a, b;
        scanf("%lf %lf", &a, &b);
        // pa[i] = 1e4 * a;
        // pb[i] = 1e4 * b;
        pa[i] = a;
        pb[i] = b;
    }

    dfs(0, 0, 0);
    printf("%.4lf\n", ans);
}

Compilation message

sure.cpp: In function 'int main()':
sure.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
sure.cpp:29:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lf %lf", &a, &b);
         ~~~~~^~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 8 ms 488 KB Output is correct
4 Correct 14 ms 488 KB Output is correct
5 Correct 10 ms 552 KB Output is correct
6 Correct 8 ms 568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 8 ms 488 KB Output is correct
4 Correct 14 ms 488 KB Output is correct
5 Correct 10 ms 552 KB Output is correct
6 Correct 8 ms 568 KB Output is correct
7 Execution timed out 2070 ms 568 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 8 ms 488 KB Output is correct
4 Correct 14 ms 488 KB Output is correct
5 Correct 10 ms 552 KB Output is correct
6 Correct 8 ms 568 KB Output is correct
7 Execution timed out 2070 ms 568 KB Time limit exceeded
8 Halted 0 ms 0 KB -