結果

問題 No.133 カードゲーム
ユーザー なおなお
提出日時 2015-01-22 23:29:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 4,091 ms / 5,000 ms
コード長 987 bytes
コンパイル時間 1,145 ms
コンパイル使用メモリ 145,308 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 09:20:33
合計ジャッジ時間 98,990 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4,019 ms
4,380 KB
testcase_01 AC 4,020 ms
4,380 KB
testcase_02 AC 4,019 ms
4,380 KB
testcase_03 AC 4,022 ms
4,380 KB
testcase_04 AC 4,019 ms
4,376 KB
testcase_05 AC 4,022 ms
4,376 KB
testcase_06 AC 4,020 ms
4,376 KB
testcase_07 AC 4,018 ms
4,376 KB
testcase_08 AC 4,019 ms
4,376 KB
testcase_09 AC 4,019 ms
4,376 KB
testcase_10 AC 4,091 ms
4,380 KB
testcase_11 AC 4,020 ms
4,380 KB
testcase_12 AC 4,020 ms
4,380 KB
testcase_13 AC 4,024 ms
4,376 KB
testcase_14 AC 4,019 ms
4,376 KB
testcase_15 AC 4,020 ms
4,376 KB
testcase_16 AC 4,021 ms
4,376 KB
testcase_17 AC 4,019 ms
4,380 KB
testcase_18 AC 4,020 ms
4,380 KB
testcase_19 AC 4,019 ms
4,380 KB
testcase_20 AC 4,022 ms
4,376 KB
testcase_21 AC 4,020 ms
4,376 KB
testcase_22 AC 4,019 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define REP(i, n)           for(int(i)=0;(i)<(n);++(i))
const int MOD = int(1e9+7);

int N,M,W,H;
int res = 0;

unsigned int xor128(void) {
    static unsigned int x=123456789,y=362436069,z=521288629,w=88675123;
    unsigned int t=(x^(x<<11));x=y;y=z;z=w; return( w=(w^(w>>19))^(t^(t>>8)) );
}

int A[11],B[11];

int main(){
    cin >> N;
    REP(i,N) cin >> A[i];
    REP(i,N) cin >> B[i];

    clock_t t = clock() + CLOCKS_PER_SEC * 4;
    int total = 0, win = 0;
    while(t >= clock()){
        int aw = 0, bw = 0;
        for(int i = 0; i < N; i++){
            int ai = xor128()%(N-i)+i;
            int bi = xor128()%(N-i)+i;

            swap(A[i],A[ai]);
            swap(B[i],B[bi]);

            if(A[i]>B[i]) aw++; else bw++;
        }
        if(aw > bw) win++;
        total++;
    }


    cout << setprecision(9) << (1.*win/total) << endl;
    return 0;
}
0