結果
問題 |
No.133 カードゲーム
|
ユーザー |
|
提出日時 | 2020-07-17 13:21:52 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 966 bytes |
コンパイル時間 | 1,000 ms |
コンパイル使用メモリ | 113,956 KB |
最終ジャッジ日時 | 2025-01-11 21:45:25 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <map> #include <queue> #include <cstdio> #include <ctime> #include <assert.h> #include <chrono> #include <random> #include <numeric> #include <set> using namespace std; typedef long long int ll; typedef unsigned long long ull; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; vector<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.begin(), a.end()); sort(b.begin(), b.end()); int al=0; int win=0; do{ do{ al++; int w=0; int l=0; for(int i=0;i<n;i++){ if(a[i]>b[i])w++; else l++; } if(w>l)win++; }while(next_permutation(b.begin(), b.end())); }while(next_permutation(a.begin(), a.end())); printf("%.9f\n",(double)(win)/al ); }