結果
| 問題 | No.133 カードゲーム | 
| コンテスト | |
| ユーザー |  nenuon | 
| 提出日時 | 2018-03-30 21:08:00 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 974 bytes | 
| コンパイル時間 | 977 ms | 
| コンパイル使用メモリ | 102,200 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-26 00:45:24 | 
| 合計ジャッジ時間 | 1,708 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 19 | 
ソースコード
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  vector<int> v1(n),v2(n);
  FOR(i,0,n)cin>>v1[i];
  FOR(i,0,n)cin>>v2[i];
  sort(v1.begin(),v1.end());
  sort(v2.begin(),v2.end());
  double ans=0.0;
  int step=0;
  do{
    do{
      step++;
      int cnt=0;
      FOR(i,0,n){
        if(v1[i]>v2[i])cnt++;
      }
      if(cnt>n/2)ans+=1.0;
    }while(next_permutation(v2.begin(),v2.end()));
  }while(next_permutation(v1.begin(),v1.end()));
  cout<<ans/step<<endl;
}
            
            
            
        