結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2018-03-10 18:24:59 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 536 bytes |
コンパイル時間 | 793 ms |
コンパイル使用メモリ | 59,612 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-25 04:21:53 |
合計ジャッジ時間 | 1,384 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <iostream> #include <algorithm> #include <cstdio> using namespace std; int main(){ int n; cin >> n; int a[n], b[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); int win=0, cnt=0; do{ do{ int tmpWin=0; for(int i=0; i<n; i++) { if(a[i]>b[i]) tmpWin++; } if(tmpWin > n-tmpWin) win++; cnt++; }while(next_permutation(b, b+n)); }while(next_permutation(a, a+n)); printf("%lf\n", (win*1.0)/cnt); return 0; }