結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-16 22:20:40 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 1,256 bytes |
| コンパイル時間 | 4,289 ms |
| コンパイル使用メモリ | 266,536 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-09-28 20:55:26 |
| 合計ジャッジ時間 | 5,103 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#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;
}