結果

問題 No.133 カードゲーム
ユーザー mofuuni1129mofuuni1129
提出日時 2024-02-16 22:20:40
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 1,256 bytes
コンパイル時間 4,761 ms
コンパイル使用メモリ 266,856 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-02-16 22:20:48
合計ジャッジ時間 5,575 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vpi=vector<pii>;
using vl=vector<ll>;
using vpl=vector<pll>;
#define cY cout <<"Yes\n"
#define cN cout <<"No\n"
#define csp cout <<" "
#define out(a) cout <<(a)
#define fout(a) cout <<fixed <<setprecision(15) <<(a)
#define cout(a) cout <<(a) <<"\n"
#define fcout(a) cout <<fixed <<setprecision(15) <<(a) <<"\n"
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
ll minv(ll a,ll m){
    ll b=m,u=1,v=0;
    while(b){
        ll t=a/b;
        a-=t*b; swap(a,b);
        u-=t*v; swap(u,v);
    }
    u%=m;
    if(u<0)u+=m;
    return u;
}

int main(){
    int n,a[4],b[4];
    cin >>n;
    for(int i=0; i<n; i++)cin >>a[i];
    for(int i=0; i<n; i++)cin >>b[i];
    sort(a,a+n);
    sort(b,b+n);
    double cnt=0,win=0;
    do{
        do{
            cnt++;
            int x=0;
            for(int i=0; i<n; i++){
                if(a[i]>b[i])x++;
            }
            if(x>n-x)win++;
        }while(next_permutation(b,b+n));
    }while(next_permutation(a,a+n));
    cout(win/cnt);
    return 0;
}
0