結果
問題 | No.1935 Water Simulation |
ユーザー | misonikomipan |
提出日時 | 2022-05-13 21:53:16 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,512 bytes |
コンパイル時間 | 168 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 85,760 KB |
最終ジャッジ日時 | 2024-07-22 01:38:39 |
合計ジャッジ時間 | 7,842 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 161 ms
85,632 KB |
testcase_05 | AC | 158 ms
85,376 KB |
testcase_06 | AC | 160 ms
85,120 KB |
testcase_07 | AC | 158 ms
85,488 KB |
testcase_08 | AC | 160 ms
85,076 KB |
testcase_09 | AC | 167 ms
85,248 KB |
testcase_10 | AC | 160 ms
85,376 KB |
testcase_11 | AC | 164 ms
85,512 KB |
testcase_12 | AC | 160 ms
85,120 KB |
testcase_13 | AC | 160 ms
85,032 KB |
testcase_14 | AC | 157 ms
85,528 KB |
testcase_15 | AC | 157 ms
85,376 KB |
testcase_16 | AC | 156 ms
85,376 KB |
testcase_17 | AC | 155 ms
85,376 KB |
testcase_18 | AC | 158 ms
84,968 KB |
testcase_19 | AC | 160 ms
85,376 KB |
testcase_20 | AC | 157 ms
85,120 KB |
testcase_21 | AC | 159 ms
85,028 KB |
testcase_22 | AC | 161 ms
85,376 KB |
testcase_23 | AC | 158 ms
85,236 KB |
testcase_24 | AC | 160 ms
85,500 KB |
testcase_25 | AC | 163 ms
85,372 KB |
testcase_26 | AC | 160 ms
85,504 KB |
testcase_27 | AC | 159 ms
85,504 KB |
testcase_28 | AC | 161 ms
85,148 KB |
testcase_29 | AC | 158 ms
85,120 KB |
testcase_30 | AC | 158 ms
85,504 KB |
testcase_31 | AC | 159 ms
84,992 KB |
ソースコード
import nntplib import sys import math import heapq from collections import deque, Counter, defaultdict from sys import stdin INF = 10 ** 7 int1 = lambda x: int(x) - 1 stinput = lambda: stdin.readline()[:-1] ii = lambda: int(stinput()) # int input mi = lambda: map(int, stdin.readline().split()) # map input (int) li = lambda: list(mi()) # list input (int) mi1 = lambda: map(int1, stdin.readline().split()) # map input (int)-1 li1 = lambda: list(mi1()) # list input (int)-1 mis = lambda: map(str, stdin.readline().split()) # map input (string) lis = lambda: list(mis()) # list input (string) *V, N = mi() nV = [V[i] if not(i) else 0 for i in range(4)] d = {(V[0], 0, 0, 0): 0} d2 = {0: (V[0], 0, 0, 0)} for n in range(N): pV = [nV[i] for i in range(4)] if n % 4 == 0: nV[1] = min(V[1], pV[1] + pV[0]) nV[0] = pV[0] - (nV[1] - pV[1]) elif n % 4 == 1: nV[2] = min(V[2], pV[2] + pV[1]) nV[1] = pV[1] - (nV[2] - pV[2]) elif n % 4 == 2: nV[3] = min(V[3], pV[3] + pV[2]) nV[2] = pV[2] - (nV[3] - pV[3]) else: nV[0] = min(V[0], pV[0] + pV[3]) nV[3] = pV[3] - (nV[0] - pV[0]) tnV = tuple(nV) if tnV in d: d[(N, N, N, N)] = n + 1 d2[n + 1] = tnV roopStart = d[tnV] roopEnd = n + 1 a = nV break else: d[tnV] = n + 1 d2[n + 1] = tnV if n == N - 1: print(*nV) exit() print(*d2[roopStart + (N - roopStart) % (roopEnd - roopStart)])