結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-07-13 05:58:33 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 704 bytes |
| コンパイル時間 | 2,030 ms |
| コンパイル使用メモリ | 198,948 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2025-07-13 05:58:36 |
| 合計ジャッジ時間 | 3,295 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int N; cin >> N;
vector<int> A(N),B(N);
for(auto &a : A) cin >> a;
for(auto &b : B) cin >> b;
vector<int> P(N);
iota(P.begin(),P.end(),0);
int all = 0,win = 0;
do{
vector<int> Q(N);
iota(Q.begin(),Q.end(),0);
do{
int ok = 0;
for(int i=0; i<N; i++) ok += A.at(P.at(i))>B.at(Q.at(i));
if(ok+ok > N) win++;
all++;
}while(next_permutation(Q.begin(),Q.end()));
}while(next_permutation(P.begin(),P.end()));
cout << fixed << setprecision(20) << win/(all+0.0) << endl;
}