結果

問題 No.2432 Flip and Move
ユーザー ntudantuda
提出日時 2023-08-19 14:03:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 488 ms / 2,000 ms
コード長 939 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 86,860 KB
実行使用メモリ 162,232 KB
最終ジャッジ日時 2023-08-19 14:03:59
合計ジャッジ時間 14,091 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,036 KB
testcase_01 AC 63 ms
71,112 KB
testcase_02 AC 185 ms
93,936 KB
testcase_03 AC 488 ms
162,232 KB
testcase_04 AC 94 ms
84,520 KB
testcase_05 AC 93 ms
84,468 KB
testcase_06 AC 118 ms
86,116 KB
testcase_07 AC 302 ms
133,364 KB
testcase_08 AC 303 ms
137,488 KB
testcase_09 AC 390 ms
159,292 KB
testcase_10 AC 129 ms
87,672 KB
testcase_11 AC 152 ms
89,128 KB
testcase_12 AC 130 ms
85,912 KB
testcase_13 AC 137 ms
89,728 KB
testcase_14 AC 172 ms
97,232 KB
testcase_15 AC 326 ms
147,668 KB
testcase_16 AC 166 ms
79,844 KB
testcase_17 AC 250 ms
84,908 KB
testcase_18 AC 135 ms
80,488 KB
testcase_19 AC 213 ms
83,552 KB
testcase_20 AC 228 ms
86,276 KB
testcase_21 AC 238 ms
83,240 KB
testcase_22 AC 184 ms
82,728 KB
testcase_23 AC 149 ms
80,184 KB
testcase_24 AC 208 ms
84,156 KB
testcase_25 AC 190 ms
82,564 KB
testcase_26 AC 183 ms
85,012 KB
testcase_27 AC 90 ms
76,900 KB
testcase_28 AC 96 ms
76,784 KB
testcase_29 AC 250 ms
81,980 KB
testcase_30 AC 240 ms
85,224 KB
testcase_31 AC 149 ms
82,612 KB
testcase_32 AC 107 ms
77,384 KB
testcase_33 AC 264 ms
84,784 KB
testcase_34 AC 157 ms
80,456 KB
testcase_35 AC 154 ms
82,584 KB
testcase_36 AC 62 ms
71,460 KB
testcase_37 AC 63 ms
71,396 KB
testcase_38 AC 60 ms
71,288 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