結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2018-08-29 13:26:24 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 1,009 bytes |
コンパイル時間 | 1,482 ms |
コンパイル使用メモリ | 163,728 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-13 13:51:10 |
合計ジャッジ時間 | 2,360 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; const int MOD = 1e9+7; const int INF = 1e9; const ll INFll = 1e18; #define put(n) cout<<(n)<<endl #define Cout(n) cout<<(n) #define rep(i,num,N) for(int(i)=(num);(i)<(N);++(i)) #define rrep(i,num,N) for(int (i)=(num);(i)>(N);--(i)) #define all(v) (v).begin() , (v).end() #define rall(v) (v).rbegin() , (v).rend() #define MP make_pair #define pb(q) push_back(q) int dx[4] = {0,0,1,-1}; int dy[4] = {1,-1,0,0}; int main(){ cin.tie(0); ios::sync_with_stdio(false); int N; cin>>N; vector<int> A(N); vector<int> B(N); rep(i,0,N) cin>>A[i]; rep(i,0,N) cin>>B[i]; sort(all(A)); sort(all(B)); double cnt = 0.0; double ans = 0.0; do{ int win = 0; rep(i,0,N){ if(A[i] > B[i]) ++win; } if(win >= N/2+1) ans += 1.0; cnt += 1.0; }while(next_permutation(all(A))); cout << fixed << setprecision(10) << ans/cnt << endl; }