結果
| 問題 |
No.133 カードゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-12-30 00:45:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 600 bytes |
| コンパイル時間 | 2,066 ms |
| コンパイル使用メモリ | 171,412 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-30 00:45:49 |
| 合計ジャッジ時間 | 3,435 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 19 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int N;
int main() {
cin>>N;
vector<int>A(N), B(N);
for(int i=0; i<N; i++) cin>>A[i];
for(int i=0; i<N; i++) cin>>B[i];
sort(A.begin(), A.end());
sort(B.begin(), B.end());
int sum = 0;
int cnt = 0;
do {
do {
int win = 0;
for(int i=0; i<N; i++)if(A[i] > B[i]) win++;
if(win*2>N) cnt++;
sum++;
}while(next_permutation(B.begin(), B.end()));
}while(next_permutation(A.begin(), A.end()));
cout<<(double)cnt / (double)sum<<endl;
}