結果
問題 | No.2432 Flip and Move |
ユーザー |
![]() |
提出日時 | 2023-09-18 16:04:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 315 ms / 2,000 ms |
コード長 | 490 bytes |
コンパイル時間 | 216 ms |
コンパイル使用メモリ | 82,504 KB |
実行使用メモリ | 183,748 KB |
最終ジャッジ日時 | 2024-07-05 06:32:05 |
合計ジャッジ時間 | 8,454 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 36 |
ソースコード
from math import gcd H, W = map(int, input().split()) K = int(input()) lcm = H * W // gcd(H, W) K %= 2 * lcm x, y = 0, 0 G = [[0] * W for i in range(H)] def plot(G, x, y): x %= 2 * H y %= 2 * W if x >= H: x = 2 * H - 1 - x if y >= W: y = 2 * W - 1 - y G[x][y] = 1 - G[x][y] for _ in range(K): plot(G, x, y) x, y = x + 1, y + 1 def f(c): return "#" if c else "." for i in range(H): ans = list(map(f, G[i])) print(*ans, sep="")