結果
| 問題 |
No.173 カードゲーム(Medium)
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2025-11-01 01:37:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 2,836 ms / 3,000 ms |
| コード長 | 869 bytes |
| コンパイル時間 | 300 ms |
| コンパイル使用メモリ | 82,608 KB |
| 実行使用メモリ | 78,596 KB |
| 最終ジャッジ日時 | 2025-11-01 01:37:46 |
| 合計ジャッジ時間 | 32,651 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import sys
input = sys.stdin.readline
from time import time
time0=time()
from random import randint,random
N,PA,PB=map(float,input().split())
N=int(N)
A0=list(map(int,input().split()))
B0=list(map(int,input().split()))
LA=0
LB=0
while time()-time0<2.8:
A=A0[:]
B=B0[:]
scorea=0
scoreb=0
for i in range(N):
A.sort()
B.sort()
x=random()
if x<PA or len(A)==1:
ind=0
else:
ind=randint(1,len(A)-1)
y=random()
if y<PB or len(B)==1:
ind2=0
else:
ind2=randint(1,len(B)-1)
xa=A.pop(ind)
xb=B.pop(ind2)
if xa>xb:
scorea+=xa+xb
elif xa<xb:
scoreb+=xa+xb
if scorea>scoreb:
LA+=1
else:
LB+=1
print(LA/(LA+LB))
titia