結果

問題 No.133 カードゲーム
ユーザー GraphiumGraphium
提出日時 2020-04-23 21:57:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,806 bytes
コンパイル時間 1,434 ms
コンパイル使用メモリ 166,596 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-22 01:57:55
合計ジャッジ時間 2,088 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using mii = map<int, int>;
const int INF = 1e9;
const ll LINF = 1e18;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define ALL(x) (x).begin(),(x).end()
#define IN(type,a) type a;cin >> a
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define COUT(x) cout << (x) << endl
#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl
int gcd(int x, int y){
    if ((x==1)||(y==1)) {
        return 1;
    }
    if (x>y) {
        if (x%y==0) {
            return y;
        }else{
            return gcd(y, x%y);
        }
    }else{
        if (y%x==0) {
            return x;
        }else{
            return gcd(x, y%x);
        }
    }
}

int main() {
    IN(int, n);
    vector<int> a(n);
    vector<int> b(n);
    REP(i, n){
        cin >> a[i];
    }
    REP(i, n){
        cin >> b[i];
    }
    double totalWin = 0;
    double total = 0;
    do {
        do {
            int win = 0;
            int lose = 0;
            REP(i, n){
                if (a[i] > b[i]) {
                    win++;
                }else{
                    lose++;
                }
            }
            if (win > lose) {
                totalWin++;
            }
            total++;
        } while (next_permutation(ALL(b)));
    } while (next_permutation(ALL(a)));
    
    COUT(totalWin);
    COUT(total);
    cout << fixed << setprecision(10) << totalWin/total << endl;
}


0