結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2021-01-21 13:24:13 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 62 ms / 5,000 ms |
コード長 | 599 bytes |
コンパイル時間 | 682 ms |
コンパイル使用メモリ | 76,512 KB |
最終ジャッジ日時 | 2025-01-18 03:04:40 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include<iostream>#include<vector>#include<algorithm>using namespace std;int main(){int n;cin >> n;vector<int> a(n),b(n),ind(n);for(auto &x : a) cin >> x;for(auto &x : b) cin >> x;for(int i=0;i < n;i++) ind[i] = i;int all = 0,win = 0;do{int aa = 0;for(int i=0;i < n;i++){if(a[ind[i]] > b[i]) aa++;else aa--;}all++;if(aa > 0) win++;}while(next_permutation(ind.begin(),ind.end()));double ans = (double)win/(double)all;cout << ans << endl;return 0;}