結果
問題 | No.173 カードゲーム(Medium) |
ユーザー | rlangevin |
提出日時 | 2023-10-30 00:03:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 2,494 ms / 3,000 ms |
コード長 | 850 bytes |
コンパイル時間 | 371 ms |
コンパイル使用メモリ | 82,160 KB |
実行使用メモリ | 79,592 KB |
最終ジャッジ日時 | 2024-09-25 17:00:00 |
合計ジャッジ時間 | 16,389 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
import randomN, PA, PB = input().split()A = list(map(int, input().split()))B = list(map(int, input().split()))A.sort(reverse=True)B.sort(reverse=True)N = int(N)PA, PB = int(float(PA) * 1000) , int(float(PB) * 1000)win = 0def f(L, P):temp = []for i in range(N):v = random.randint(1, 1000)if v <= P or i == N - 1:temp.append(L.pop())else:ind = random.randint(0, len(L) - 2)temp.append(L.pop(ind))return tempM = 5 * 10 ** 5for _ in range(M):LA, LB = [], []for i in range(N):LA.append(A[i])LB.append(B[i])VA = f(LA, PA)VB = f(LB, PB)SA, SB = 0, 0for a, b in zip(VA, VB):if a > b:SA += a + belse:SB += a + bif SA > SB:win += 1print(win/M)