結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2020-09-22 18:09:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 530 bytes |
コンパイル時間 | 1,645 ms |
コンパイル使用メモリ | 169,292 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 08:20:47 |
合計ジャッジ時間 | 2,571 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for (int i = 0; i < (n); ++i)using namespace std;using ll = long long;using P = pair<int,int>;const int N = 4;int n, a[N], b[N];int main() {cin >> n;rep(i, n) cin >> a[i];rep(i, n) cin >> b[i];sort(b, b + n);int numer = 0;int denom = 0;do {int awin = 0;rep(i, n) if (a[i] > b[i]) awin++;if (2 * awin > n) numer++;denom++;} while (next_permutation(b, b + n));double ans = (double)numer / denom;printf("%.2f\n", ans);return 0;}