結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2020-06-30 02:12:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 773 bytes |
コンパイル時間 | 1,584 ms |
コンパイル使用メモリ | 171,860 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 06:14:01 |
合計ジャッジ時間 | 2,434 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main(){int N;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());double max = 0;double vic = 0;do{do{max++;int judge = 0;for(int i = 0; i < N; i++){if(A[i] > B[i]) judge++;if(A[i] < B[i]) judge--;}if(judge > 0) vic++;}while(next_permutation(B.begin(),B.end()));sort(B.begin(),B.end());}while(next_permutation(A.begin(),A.end()));double p = vic / max;cout << fixed << setprecision(5) << p << endl;}