結果
| 問題 | No.133 カードゲーム |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-25 18:17:17 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| + 384µs | |
| コード長 | 656 bytes |
| 記録 | |
| コンパイル時間 | 1,705 ms |
| コンパイル使用メモリ | 178,704 KB |
| 実行使用メモリ | 6,400 KB |
| 最終ジャッジ日時 | 2026-08-25 18:17:22 |
| 合計ジャッジ時間 | 3,048 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(void){
int n; cin >> n;
vector<int> a(n), b(n);
for(auto&x:a) cin >> x;
for(auto&x:b) cin >> x;
int c=0, all=0;
vector<int> pa(n);
for(int i=0; i<n; i++) pa[i]=i;
do{
vector<int> pb(n);
for(int i=0; i<n; i++) pb[i]=i;
do{
all++;
int wa=0, wb=0;
for(int i=0; i<n; i++){
if(a[pa[i]]>b[pb[i]]) wa++;
else wb++;
}
if(wa>wb) c++;
}while(next_permutation(begin(pb), end(pb)));
}while(next_permutation(begin(pa), end(pa)));
printf("%.10f\n", (double)c/all);
return 0;
}