結果

問題 No.133 カードゲーム
ユーザー 👑 potato167potato167
提出日時 2020-12-08 14:49:41
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 629 bytes
コンパイル時間 1,813 ms
コンパイル使用メモリ 174,624 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 17:15:07
合計ジャッジ時間 3,031 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 1 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 2 ms
4,348 KB
testcase_22 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll=long long;
ll I=167167167167;
ll Q=1e9+7;


int main() {
	int N,A=1,L=0;
	cin>>N;
	vector<ll> a(N);
	vector<ll> b(N);
	for(int i=0;i<N;i++) cin>>a[i];
	for(int i=0;i<N;i++) cin>>b[i],A*=(i+1);
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());
	for(int i=0;i<A;i++){
		vector<ll> p=b;
		for(int j=0;j<A;j++){
			ll Z=0;
			for(int k=0;k<N;k++){
				if(a[k]>p[k]) Z++;
				if(a[k]<p[k]) Z--;
			}
			if(Z>0) L++;
			next_permutation(p.begin(),p.end());
		}
		next_permutation(a.begin(),a.end());
	}
	long double X=A*A,Y=L;
	cout<<fixed<<setprecision(15);
	cout<<Y/X<<endl;
}
0