結果
| 問題 |
No.1004 サイコロの実装 (2)
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:21:48 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 729 bytes |
| コンパイル時間 | 238 ms |
| コンパイル使用メモリ | 82,460 KB |
| 実行使用メモリ | 82,944 KB |
| 最終ジャッジ日時 | 2025-03-20 21:22:42 |
| 合計ジャッジ時間 | 5,335 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 TLE * 1 -- * 13 |
ソースコード
a, b, x0, N = map(int, input().split())
if N == 0:
print(0, 0)
else:
x_prev = x0
cur_t = 0
cur_a = 0
cnt_tb = 0
cnt_tw = 0
cnt_ab = 0
cnt_aw = 0
for i in range(1, 2 * N + 1):
xi = (a * x_prev + b) % (1 << 32)
di = (xi % 6) + 1
if i % 2 == 1: # Takahashi's turn
cur_t += di
if cur_t % 2 == 1:
cnt_tb += 1
else:
cnt_tw += 1
else: # Aoki's turn
cur_a += di
if cur_a % 2 == 1:
cnt_ab += 1
else:
cnt_aw += 1
x_prev = xi
score_t = min(cnt_tb, cnt_tw)
score_a = min(cnt_ab, cnt_aw)
print(score_t, score_a)
lam6er