結果
| 問題 |
No.1935 Water Simulation
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-13 23:09:16 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,036 bytes |
| コンパイル時間 | 261 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-07-22 03:28:23 |
| 合計ジャッジ時間 | 2,246 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 25 WA * 4 |
ソースコード
v1, v2, v3, v4, N = map(int, input().strip().split())
def next_status(status, turn):
a, b, c, d = status
t = turn % 4
if t == 0:
if a > v2 - b:
a, b = a + b - v2, v2
else:
a, b = 0, a + b
elif t == 1:
if b > v3 - c:
b, c = b + c - v3, v3
else:
b, c = 0, b + c
elif t == 2:
if c > v4 - d:
c, d = c + d - v4, v4
else:
c, d = 0, c + d
else:
if d > v1 - a:
d, a = d + a - v1, v1
else:
d, a = 0, a + d
return (a, b, c, d)
def solve(N):
dic = dict()
status = (v1, 0, 0, 0)
hist = [status]
turn = 0
while status not in dic:
dic[status] = turn
status = next_status(status, turn)
hist.append(status)
turn += 1
if turn == N:
return status
head = dic[status]
cycle = turn - head
ans = (N - head) % cycle
return hist[head + ans]
a, b, c, d = solve(N)
print(a, b, c, d)