結果

問題 No.2432 Flip and Move
ユーザー ntudantuda
提出日時 2023-08-19 14:03:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 466 ms / 2,000 ms
コード長 939 bytes
コンパイル時間 691 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 161,280 KB
最終ジャッジ日時 2024-05-06 21:12:38
合計ジャッジ時間 11,454 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
52,096 KB
testcase_01 AC 38 ms
52,096 KB
testcase_02 AC 157 ms
92,672 KB
testcase_03 AC 462 ms
161,280 KB
testcase_04 AC 85 ms
83,284 KB
testcase_05 AC 84 ms
83,584 KB
testcase_06 AC 108 ms
84,804 KB
testcase_07 AC 352 ms
132,096 KB
testcase_08 AC 351 ms
136,448 KB
testcase_09 AC 466 ms
158,592 KB
testcase_10 AC 129 ms
86,400 KB
testcase_11 AC 155 ms
88,096 KB
testcase_12 AC 126 ms
84,736 KB
testcase_13 AC 132 ms
88,188 KB
testcase_14 AC 174 ms
96,640 KB
testcase_15 AC 382 ms
147,016 KB
testcase_16 AC 175 ms
79,128 KB
testcase_17 AC 248 ms
83,564 KB
testcase_18 AC 133 ms
79,232 KB
testcase_19 AC 220 ms
82,616 KB
testcase_20 AC 237 ms
85,248 KB
testcase_21 AC 251 ms
82,048 KB
testcase_22 AC 177 ms
81,892 KB
testcase_23 AC 147 ms
79,184 KB
testcase_24 AC 224 ms
83,072 KB
testcase_25 AC 202 ms
81,664 KB
testcase_26 AC 199 ms
83,412 KB
testcase_27 AC 87 ms
75,776 KB
testcase_28 AC 91 ms
76,400 KB
testcase_29 AC 244 ms
81,152 KB
testcase_30 AC 277 ms
84,044 KB
testcase_31 AC 171 ms
81,476 KB
testcase_32 AC 105 ms
76,392 KB
testcase_33 AC 295 ms
83,604 KB
testcase_34 AC 165 ms
79,488 KB
testcase_35 AC 137 ms
81,536 KB
testcase_36 AC 39 ms
52,096 KB
testcase_37 AC 39 ms
51,840 KB
testcase_38 AC 40 ms
52,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W = map(int,input().split())
K = int(input())
S = [[0] * W for _ in range(H)]

def turn(k):
    x, y = 0, 0
    dx, dy = 1, 1
    cycle = 0
    cnt = 0
    flag = 1
    while flag and cycle < k:
        cycle += 1
        S[x][y] ^= 1
        #print(x,y,S[x][y])
        if S[x][y] == 1:
            cnt+= 1
        else:
            cnt -= 1
        if cnt == 0:
            flag = 0
        if dx == 1:
            if x < H - 1:
                x += 1
            else:
                dx = -1
        else:
            if x > 0:
                x -= 1
            else:
                dx = 1
        if dy == 1:
            if y < W - 1:
                y += 1
            else:
                dy = -1
        else:
            if y > 0:
                y -= 1
            else:
                dy = 1
    return cycle

c = turn(K)
#print(c)
turn(K % c)

for i in range(H):
    print("".join(["." if s == 0 else "#" for s in S[i]]))
0