結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
fukuta0614
|
| 提出日時 | 2019-03-26 01:17:46 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 666 bytes |
| コンパイル時間 | 1,768 ms |
| コンパイル使用メモリ | 171,936 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-10 04:03:24 |
| 合計ジャッジ時間 | 2,660 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
// asdf_o
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define ALL(x) x.begin(), x.end()
#define COUT(x) cout << x << endl
int main() {
int N;
cin >> N;
vector<int> A(N), B(N);
REP(i, N) cin >> A[i];
REP(i, N) cin >> B[i];
sort(ALL(A)); sort(ALL(B));
double trial = 0;
double vic = 0;
do {
do {
int count = 0;
REP(i, N) {if (A[i] > B[i]) count++;}
if (2 * count > N) vic++;
trial++;
} while( next_permutation(ALL(B)));
} while( next_permutation(ALL(A)));
COUT(vic / trial);
return 0;
}
fukuta0614