結果
問題 |
No.133 カードゲーム
|
ユーザー |
|
提出日時 | 2023-08-04 22:41:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 29 ms / 5,000 ms |
コード長 | 768 bytes |
コンパイル時間 | 1,790 ms |
コンパイル使用メモリ | 198,208 KB |
最終ジャッジ日時 | 2025-02-15 23:05:15 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) using ll = long long; int ctoi(char c){return c-'0';} ll ctoll(char c){return c-'0';} int main(){ int n; cin >> n; vector<int>a(n); vector<int>b(n); rep(i,n)cin >> a[i]; rep(i,n)cin >> b[i]; sort(a.begin(),a.end()); sort(b.begin(),b.end()); double sum = 0; double kati = 0; do{ do{ int tmp = 0; rep(i,n){ if(a[i] > b[i])tmp++; } if(tmp > n/2)kati++; sum++; }while(next_permutation(b.begin(),b.end())); }while(next_permutation(a.begin(),a.end())); //cout << sum << " " << kati << endl; printf("%.5f\n",kati/sum); }