結果
問題 | No.133 カードゲーム |
ユーザー | 篠俊介 |
提出日時 | 2023-10-05 16:23:51 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 813 bytes |
コンパイル時間 | 2,219 ms |
コンパイル使用メモリ | 205,292 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-26 15:03:33 |
合計ジャッジ時間 | 3,211 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h> //#include <atcoder/all> using namespace std; //using namespace atcoder; const static int NIL = -1; const long long INF = 1LL << 60; typedef long long ll; typedef unsigned long long ull; bool is_debug = false; int ini = 1000000001; ull mod = 1000000007; int main(){ int n; cin >> n; vector<int> a(n); vector<int> 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 all = 0; int win = 0; do{ do{ all++; int cnt = 0; for(int i = 0; i < n; i++){ if(a[i] > b[i])cnt++; } if(cnt * 2 > n)win++; }while(next_permutation(b.begin(), b.end())); }while(next_permutation(a.begin(), a.end())); cout << setprecision(10) << (double)win / all << endl; }