結果

問題 No.2432 Flip and Move
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2023-08-18 23:15:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 576 ms / 2,000 ms
コード長 902 bytes
コンパイル時間 648 ms
コンパイル使用メモリ 86,820 KB
実行使用メモリ 147,444 KB
最終ジャッジ日時 2023-08-18 23:15:40
合計ジャッジ時間 14,167 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,520 KB
testcase_01 AC 78 ms
71,204 KB
testcase_02 AC 190 ms
125,788 KB
testcase_03 AC 425 ms
147,444 KB
testcase_04 AC 139 ms
117,080 KB
testcase_05 AC 138 ms
117,096 KB
testcase_06 AC 173 ms
102,920 KB
testcase_07 AC 324 ms
123,056 KB
testcase_08 AC 360 ms
126,484 KB
testcase_09 AC 408 ms
145,188 KB
testcase_10 AC 161 ms
107,724 KB
testcase_11 AC 210 ms
112,432 KB
testcase_12 AC 157 ms
103,308 KB
testcase_13 AC 209 ms
112,820 KB
testcase_14 AC 181 ms
92,900 KB
testcase_15 AC 383 ms
134,872 KB
testcase_16 AC 377 ms
92,564 KB
testcase_17 AC 378 ms
112,968 KB
testcase_18 AC 195 ms
87,596 KB
testcase_19 AC 359 ms
105,280 KB
testcase_20 AC 332 ms
116,180 KB
testcase_21 AC 497 ms
104,676 KB
testcase_22 AC 301 ms
106,904 KB
testcase_23 AC 196 ms
86,068 KB
testcase_24 AC 342 ms
110,552 KB
testcase_25 AC 302 ms
103,084 KB
testcase_26 AC 291 ms
108,304 KB
testcase_27 AC 126 ms
79,032 KB
testcase_28 AC 133 ms
78,088 KB
testcase_29 AC 473 ms
102,848 KB
testcase_30 AC 533 ms
114,348 KB
testcase_31 AC 311 ms
105,232 KB
testcase_32 AC 150 ms
79,908 KB
testcase_33 AC 576 ms
113,628 KB
testcase_34 AC 344 ms
95,480 KB
testcase_35 AC 261 ms
102,180 KB
testcase_36 AC 78 ms
71,040 KB
testcase_37 AC 77 ms
71,360 KB
testcase_38 AC 80 ms
71,356 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