結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-21 19:19:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 675 bytes |
| コンパイル時間 | 1,574 ms |
| コンパイル使用メモリ | 172,124 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-30 17:39:17 |
| 合計ジャッジ時間 | 2,376 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define fastcin {\
cin.tie(0);\
ios::sync_with_stdio(false);\
}
#define rep(i, a, b) for(int i = a; i < b; i++)
#define VSORT(v) sort(v.begin(), v.end());
int main() {
fastcin;
int n, t, w, c = 0;
vector<int> a, b;
double ans = 0;
cin >> n;
rep(i, 0, n) {
cin >> t;
a.push_back(t);
}
VSORT(a);
rep(i, 0, n) {
cin >> t;
b.push_back(t);
}
do {
w = 0;
rep(i, 0, n) if(a[i]>b[i]) w++;
if(w>n/2) ans++;
c++;
} while(next_permutation(a.begin(), a.end()));
ans /= c;
cout << ans << endl;
return 0;
}