結果

問題 No.133 カードゲーム
ユーザー pekempeypekempey
提出日時 2016-12-22 21:39:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 213 ms / 5,000 ms
コード長 548 bytes
コンパイル時間 2,039 ms
コンパイル使用メモリ 167,236 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 09:27:53
合計ジャッジ時間 6,021 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
4,380 KB
testcase_01 AC 72 ms
4,380 KB
testcase_02 AC 67 ms
4,380 KB
testcase_03 AC 6 ms
4,376 KB
testcase_04 AC 146 ms
4,380 KB
testcase_05 AC 211 ms
4,376 KB
testcase_06 AC 212 ms
4,380 KB
testcase_07 AC 211 ms
4,376 KB
testcase_08 AC 145 ms
4,380 KB
testcase_09 AC 146 ms
4,380 KB
testcase_10 AC 206 ms
4,376 KB
testcase_11 AC 213 ms
4,380 KB
testcase_12 AC 212 ms
4,380 KB
testcase_13 AC 71 ms
4,376 KB
testcase_14 AC 145 ms
4,376 KB
testcase_15 AC 148 ms
4,376 KB
testcase_16 AC 209 ms
4,380 KB
testcase_17 AC 199 ms
4,380 KB
testcase_18 AC 209 ms
4,380 KB
testcase_19 AC 206 ms
4,376 KB
testcase_20 AC 208 ms
4,380 KB
testcase_21 AC 211 ms
4,376 KB
testcase_22 AC 211 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
	srand(time(NULL));

	int n;
	cin >> n;

	vector<int> a(n);
	vector<int> b(n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < n; i++) {
		scanf("%d", &b[i]);
	}
	int cnt = 0;
	for (int ii = 0; ii < 1234567; ii++) {
		random_shuffle(a.begin(), a.end());
		random_shuffle(b.begin(), b.end());
		int win = 0;
		for (int i = 0; i < n; i++) {
			if (a[i] > b[i]) win++;
			if (a[i] < b[i]) win--;
		}
		cnt += win > 0;
	}
	
	printf("%.20f\n", cnt / 1234567.0);
}
0