結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  kazuppa | 
| 提出日時 | 2024-07-07 23:21:29 | 
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 1,473 bytes | 
| コンパイル時間 | 8,098 ms | 
| コンパイル使用メモリ | 338,236 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-07 23:21:38 | 
| 合計ジャッジ時間 | 7,753 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define repa(i,n) for(it i=0;i<(it)n;i++)
#define repb(i,n) for(it i=1;i<=(it)n;i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define moda 998244353LL
#define modb 1000000007LL
#define dai 2500000000000000000LL
#define sho -dai
#define eps 1e-14
using it=long long;
using un=unsigned long long;
using db=long double;
using st=string;
using ch=char;
using bo=bool;
using P=pair<it,it>;
using T=tuple<it,it,it>;
using vi=vector<it>;
using vd=vector<db>;
using vs=vector<st>;
using vc=vector<ch>;
using vb=vector<bo>;
using vp=vector<P>;
using sp=set<P>;
using ss=set<st>;
using si=set<it>;
using vvi=vector<vi>;
using vvs=vector<vs>;
using vvb=vector<vb>;
using vvc=vector<vc>;
using vvp=vector<vp>;
using vsi=vector<si>;
using vsp=vector<sp>;
using vvsi=vector<vsi>;
using vvvi=vector<vvi>;
using vvvvi=vector<vvvi>;
const it dx[4]={0,1,0,-1};
const it dy[4]={1,0,-1,0};
int main() {
  it n;db kati=0;cin>>n;
  vi a(n),b(n);
  repa(i,n)cin>>a[i];
  repa(i,n)cin>>b[i];
  sort(all(a));
  sort(all(b));
  do{
    do{
      it win=0,lose=0;
      repa(i,n){
        if(a[i]>b[i])win++;
        else lose++;
      }
      if(win>lose)kati++;
    }
    while(next_permutation(all(b)));
    sort(all(b));
  }
  while(next_permutation(all(a)));
  db wari=1;
  repb(i,n)wari*=i;
  repb(i,n)wari*=i;
  cout<<fixed<<setprecision(5);
  cout<<kati/wari<<endl;
}
            
            
            
        