結果
問題 | No.133 カードゲーム |
ユーザー |
![]() |
提出日時 | 2019-07-07 03:05:13 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 549 bytes |
コンパイル時間 | 679 ms |
コンパイル使用メモリ | 60,824 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-02 01:16:06 |
合計ジャッジ時間 | 1,203 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
ソースコード
#include<iostream>#include<cstdio>#include<algorithm>using namespace std;int main(){int N;cin >> N;int A[N];int B[N];for(int i=0;i<N;i++){cin >> A[i];}for(int i=0;i<N;i++){cin >> B[i];}sort(A,A+N);sort(B,B+N);int cnt=0;int all=0;do{int tmp=0;for(int i=0;i<N;i++){if(A[i]>B[i]) tmp++;}if(tmp>(N/2)) cnt++;all++;}while(next_permutation(A,A+N));double ans=cnt*1.0/all;printf("%.5f\n",ans);}