結果

問題 No.2432 Flip and Move
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-08-18 23:15:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 441 ms / 2,000 ms
コード長 902 bytes
コンパイル時間 306 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 146,696 KB
最終ジャッジ日時 2024-05-06 05:53:42
合計ジャッジ時間 11,020 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
52,096 KB
testcase_01 AC 38 ms
51,840 KB
testcase_02 AC 153 ms
117,760 KB
testcase_03 AC 331 ms
146,696 KB
testcase_04 AC 101 ms
115,712 KB
testcase_05 AC 102 ms
115,972 KB
testcase_06 AC 136 ms
101,640 KB
testcase_07 AC 271 ms
121,788 KB
testcase_08 AC 276 ms
125,632 KB
testcase_09 AC 352 ms
144,120 KB
testcase_10 AC 121 ms
99,968 KB
testcase_11 AC 158 ms
104,448 KB
testcase_12 AC 116 ms
95,488 KB
testcase_13 AC 162 ms
111,288 KB
testcase_14 AC 143 ms
91,984 KB
testcase_15 AC 298 ms
134,320 KB
testcase_16 AC 295 ms
91,852 KB
testcase_17 AC 326 ms
111,540 KB
testcase_18 AC 146 ms
86,332 KB
testcase_19 AC 271 ms
102,904 KB
testcase_20 AC 283 ms
115,472 KB
testcase_21 AC 423 ms
102,628 KB
testcase_22 AC 224 ms
105,728 KB
testcase_23 AC 147 ms
83,948 KB
testcase_24 AC 296 ms
109,300 KB
testcase_25 AC 256 ms
100,504 KB
testcase_26 AC 222 ms
107,944 KB
testcase_27 AC 83 ms
76,288 KB
testcase_28 AC 94 ms
76,784 KB
testcase_29 AC 415 ms
100,936 KB
testcase_30 AC 441 ms
113,308 KB
testcase_31 AC 270 ms
104,140 KB
testcase_32 AC 105 ms
78,592 KB
testcase_33 AC 407 ms
112,600 KB
testcase_34 AC 286 ms
93,840 KB
testcase_35 AC 195 ms
100,988 KB
testcase_36 AC 38 ms
52,224 KB
testcase_37 AC 38 ms
52,096 KB
testcase_38 AC 38 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

やるだけ

"""

import sys
from sys import stdin

H,W = map(int,stdin.readline().split())
K = int(stdin.readline())

ans = [0] * (H*W)

state = [-1 for i in range(4*H*W)]

x,y = 0,0
UD = 1
LR = 1

step = 0
while True:

    step += 1
    K -= 1
    ans[x*W+y] ^= 1

    if UD == 0 and x == 0:
        UD = 1
    elif UD == 1 and x == H-1:
        UD = 0
    elif UD == 0:
        x -= 1
    else:
        x += 1

    if LR == 0 and y == 0:
        LR = 1
    elif LR == 1 and y == W-1:
        LR = 0
    elif LR == 0:
        y -= 1
    else:
        y += 1

    UDLR = 2*UD+LR

    idx = UDLR*H*W + x*W + y

    if state[idx] == -1:
        state[idx] = step
    else:
        diff = step - state[idx]
        K %= 2*diff
        state[idx] = step
    
    if K == 0:
        break

ANS = [ "".join(["#" if ans[i*W+j]==1 else "." for j in range(W)]) for i in range(H)]

print (*ANS,sep="\n")
0