結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
yna
|
| 提出日時 | 2020-02-08 14:01:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 753 bytes |
| コンパイル時間 | 1,556 ms |
| コンパイル使用メモリ | 168,780 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-25 08:49:42 |
| 合計ジャッジ時間 | 2,473 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;
int N;
int A[4], B[4];
int main(void){
cin >> N;
for(int i = 0; i < N; i++) cin >> A[i];
for(int i = 0; i < N; i++) cin >> B[i];
int x = 0, y = 0;
int ar[4];
for(int i = 0; i < N; i++) ar[i] = i;
do{
y++;
int win = 0, lose = 0;
for(int i = 0; i < N; i++){
if(A[i] > B[ar[i]]) win++;
else lose++;
}
if(win > lose) x++;
}while(next_permutation(ar, ar+N));
// debug(x); debug(y);
cout << setprecision(7) << (double) x / y << '\n';
return 0;
}
yna