Submission #46423

# Submission time Handle Problem Language Result Execution time Memory
46423 2018-04-20T14:38:51 Z 1Khan Sure Bet (CEOI17_sure) C++14
20 / 100
2000 ms 488 KB
#include <bits/stdc++.h>

using namespace std;

#define Tupizm ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);

#define ONE exit(0);
#define nl "\n"

#define fly return

#define ff first
#define ss second

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

#define pb push_back
#define ppb pop_back

typedef long long ll;
typedef double db;

const int N = 1e5 + 5;
const int M = 1e9 + 7;

int n;
double a[N], b[N];
double ans;
void man(int tekel = 1, double real = 0, double barsa = 0, int euro = 0){
    if(tekel > n){
        ans = max(ans, (db)(min(real, barsa) - euro));
        fly;
    }
    man(tekel + 1, real, barsa, euro);
    man(tekel + 1, real + a[tekel], barsa, euro + 1);
    man(tekel + 1, real, barsa + b[tekel], euro + 1);
    man(tekel + 1, real + a[tekel], barsa + b[tekel], euro + 2);
}
int main(){
    
    cin >> n;
    for(int i = 1; i <= n; ++i){
        cin >> a[i] >> b[i];
    }
    man();
    cout << fixed << setprecision(4) << (db)ans << nl;
    ONE
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 7 ms 428 KB Output is correct
4 Correct 7 ms 428 KB Output is correct
5 Correct 7 ms 480 KB Output is correct
6 Correct 7 ms 480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 7 ms 428 KB Output is correct
4 Correct 7 ms 428 KB Output is correct
5 Correct 7 ms 480 KB Output is correct
6 Correct 7 ms 480 KB Output is correct
7 Execution timed out 2065 ms 488 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 7 ms 428 KB Output is correct
4 Correct 7 ms 428 KB Output is correct
5 Correct 7 ms 480 KB Output is correct
6 Correct 7 ms 480 KB Output is correct
7 Execution timed out 2065 ms 488 KB Time limit exceeded
8 Halted 0 ms 0 KB -