답안 #570747

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
570747 2022-05-31T08:15:14 Z choigameautohackrb Sure Bet (CEOI17_sure) C++14
20 / 100
2000 ms 212 KB
#include <bits/stdc++.h>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N=1e2+7;
ld a[N], b[N], n;
ll A[N], B[N];
long double ans=0;
pair <ll, ll> d[10];
void Backtrack(int i){
    for (int j=1;j<=4;j++){
        A[i]=d[j].fi;
        B[i]=d[j].se;
        if (i==n){
            ll cnt=0;
            ld tmp1=0, tmp2=0;
            for (int k=1;k<=n;k++){
                if (A[k]==1){
                    cnt++;
                    tmp1+=a[k];
                }
                if (B[k]==1){
                    cnt++;
                    tmp2+=b[k];
                }
            }
            tmp1=tmp1-cnt;
            tmp2=tmp2-cnt;
            ans=max(ans, min(tmp1, tmp2));
        } else Backtrack(i+1);
    }
}
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin>>n;
    d[1].fi=0; d[1].se=0;
    d[2].fi=1; d[2].se=1;
    d[3].fi=1; d[3].se=0;
    d[4].fi=0; d[4].se=1;
    for (int i=1;i<=n;i++) cin>>a[i]>>b[i];
    Backtrack(1);
    cout<<fixed<<setprecision(4)<<ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 80 ms 212 KB Output is correct
4 Correct 74 ms 212 KB Output is correct
5 Correct 72 ms 212 KB Output is correct
6 Correct 74 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 80 ms 212 KB Output is correct
4 Correct 74 ms 212 KB Output is correct
5 Correct 72 ms 212 KB Output is correct
6 Correct 74 ms 212 KB Output is correct
7 Execution timed out 2071 ms 212 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 80 ms 212 KB Output is correct
4 Correct 74 ms 212 KB Output is correct
5 Correct 72 ms 212 KB Output is correct
6 Correct 74 ms 212 KB Output is correct
7 Execution timed out 2071 ms 212 KB Time limit exceeded
8 Halted 0 ms 0 KB -