結果
問題 | No.133 カードゲーム |
ユーザー |
|
提出日時 | 2022-05-07 10:51:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 874 bytes |
コンパイル時間 | 991 ms |
コンパイル使用メモリ | 96,144 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-06 14:45:14 |
合計ジャッジ時間 | 1,608 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include<algorithm>#include<iostream>#include<string>#include<math.h>#include<iomanip>#include<queue>#include<set>#define ull unsigned long long#define ll long long#define rep(i,n) for(int i = 0; i < (int)(n); i++)using namespace std;int main(){int N, win=0;vector<int> A;vector<int> B;cin >> N;A.resize(N);B.resize(N);rep(i,N)cin >> A[i];rep(i,N)cin >> B[i];sort(A.begin(), A.end());sort(B.begin(), B.end());int cnt,round=0;do{do{cnt = 0;round++;rep(i,N)if(A[i]>B[i])cnt++;if(N/2<cnt)win++;}while(next_permutation(B.begin(), B.end()));}while(next_permutation(A.begin(), A.end()));cout << (float)win/(float)round << endl;return 0;}