結果

問題 No.1004 サイコロの実装 (2)
ユーザー lam6er
提出日時 2025-03-31 17:38:32
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 627 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 82,104 KB
実行使用メモリ 82,788 KB
最終ジャッジ日時 2025-03-31 17:39:12
合計ジャッジ時間 5,667 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24 TLE * 1 -- * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, x0, N = map(int, input().split())

t_black = 0
t_white = 0
a_black = 0
a_white = 0

t_pos = 0
a_pos = 0
current_x = x0

for i in range(2 * N):
    current_x = (a * current_x + b) & 0xFFFFFFFF
    dice = (current_x % 6) + 1
    
    if i % 2 == 0:
        # Takahashi's turn
        t_pos += dice
        if t_pos % 2 == 1:
            t_black += 1
        else:
            t_white += 1
    else:
        # Aoki's turn
        a_pos += dice
        if a_pos % 2 == 1:
            a_black += 1
        else:
            a_white += 1

t_score = min(t_black, t_white)
a_score = min(a_black, a_white)

print(t_score, a_score)
0