結果

問題 No.133 カードゲーム
ユーザー hjgjkvkhjvvhgbxctgdhjgjkvkhjvvhgbxctgd
提出日時 2021-12-27 15:40:06
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 2,112 bytes
コンパイル時間 6,302 ms
コンパイル使用メモリ 158,740 KB
実行使用メモリ 4,372 KB
最終ジャッジ日時 2023-10-26 01:13:34
合計ジャッジ時間 7,328 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include <atcoder/all>
using namespace std;
//using namespace boost::multiprecision;
//using namespace atcoder;
#define rep(i,n) for(int i=0;i<(n);++i)
#define lep(i,n) for(long long i=0;i<(n);++i)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define equals(a,b) (fabs((a)-(b))<eps)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x).size()
using ll=long long;
template<typename T> using vc = vector<T>;
template<typename T,typename U> using pp=pair<T,U>;
template<typename T> using PQ = priority_queue<T,vc<T>,greater<T>>;
using vi=vc<int> ;
using vvi=vc<vi>;
using vvvi=vc<vvi>;
using vl=vc<ll>;
using vvl=vc<vl>;
using vvvl=vc<vvl>;
using pi=pp<int,int>;
using pd=pp<double,double>;
using pl=pp<ll,ll>;
using pip=pp<int,pi>;
using vpi=vc<pi>;
using vvpi=vc<vpi>;
using vs=vc<string>;
using vss=vc<vs>;
using vst=vc<set<int>>;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int inf=1001001001;
const ll infl=100100100100100100;
const double eps=(1e-10);
const ll mod=1000000007;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T>
void rprint(T &a) {printf("%.10f\n",a);}
template<typename T>
void coutarray(vc<T>& v) { rep(i, sz(v)) {cout << " "; cout << v[i];} cout << endl; }
template<typename T>
void coutmatrix(vc<vc<T>>& v) { rep(i,sz(v)) { rep(j, sz(v[i])) {cout << " "; cout << v[i][j]; } cout << "\n";} };

int main(){
  int n;
  cin>>n;
  vi a(n);
  rep(i,n)cin>>a[i];
  vi b(n);
  rep(i,n)cin>>b[i];
  sort(all(b));
  sort(all(a));
  int test=0;
  int kati=0;
  do{
    do{
      test++;
      int akati=0,bkati=0;
      rep(i,n){
        if(a[i]>b[i])akati++;
        if(a[i]<b[i])bkati++;
      }
      if(akati>bkati)kati++;
    }while(next_permutation(all(b)));
  }while(next_permutation(all(a)));
  double ans=(double)kati/test;
  rprint(ans);
  return 0;
}
0