結果
| 問題 | No.133 カードゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-04 01:32:45 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 753 bytes |
| 記録 | |
| コンパイル時間 | 5,778 ms |
| コンパイル使用メモリ | 337,588 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-04-04 01:33:14 |
| 合計ジャッジ時間 | 6,469 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF=10000000;
int main(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
#endif
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin>>N;
vector<int> Acard(N);
vector<int> Bcard(N);
rep(i,N){
cin>>Acard[i];
}
rep(i,N){
cin>>Bcard[i];
}
double res=0;
sort(Bcard.begin(),Bcard.end());
do{
int sum=0;
rep(i,N){
if(Acard[i]>Bcard[i]) sum++;
}
if(sum>N/2) res++;
}while(next_permutation(Bcard.begin(),Bcard.end()));
double all=1;
for(int i=N;i>0;i--){
all*=i;
}
cout<<res/all<<endl;
}