結果

問題 No.565 回転拡大
ユーザー sue_charosue_charo
提出日時 2017-09-11 18:35:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 1,362 bytes
コンパイル時間 95 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-04-25 06:49:28
合計ジャッジ時間 2,236 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 32 ms
10,880 KB
testcase_05 AC 32 ms
10,880 KB
testcase_06 AC 32 ms
10,880 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 31 ms
10,880 KB
testcase_09 AC 33 ms
10,752 KB
testcase_10 AC 31 ms
10,880 KB
testcase_11 AC 30 ms
10,752 KB
testcase_12 AC 33 ms
10,880 KB
testcase_13 AC 32 ms
10,752 KB
testcase_14 AC 32 ms
10,880 KB
testcase_15 AC 31 ms
10,880 KB
testcase_16 AC 32 ms
10,752 KB
testcase_17 AC 31 ms
10,880 KB
testcase_18 AC 32 ms
10,752 KB
testcase_19 AC 31 ms
10,752 KB
testcase_20 AC 32 ms
10,880 KB
testcase_21 AC 32 ms
10,752 KB
testcase_22 AC 32 ms
10,752 KB
testcase_23 AC 31 ms
10,880 KB
testcase_24 AC 33 ms
10,880 KB
testcase_25 AC 33 ms
10,880 KB
testcase_26 AC 32 ms
10,752 KB
testcase_27 AC 30 ms
10,752 KB
testcase_28 AC 32 ms
10,880 KB
testcase_29 AC 31 ms
10,880 KB
testcase_30 AC 31 ms
10,752 KB
testcase_31 AC 30 ms
10,880 KB
testcase_32 AC 32 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
def II(): return int(input())
def ILI(): return list(map(int, input().split()))


def read():
    R, K = ILI()
    H, W = ILI()
    c = [list(str(input())) for __ in range(H)]
    return R, K, H, W, c


def rotate(R, H, W, c):
    if R == 90:
        ret_c = [[None] * H for __ in range(W)]
        for h in range(H):
            for w in range(W):
                ret_c[w][H - 1 - h] = c[h][w]
    elif R == 180:
        ret_c = [[None] * W for __ in range(H)]
        for h in range(H):
            ret_c[H - 1 - h] = c[h][::-1]
    elif R == 270:
        ret_c = [[None] * H for __ in range(W)]
        for h in range(H):
            for w in range(W):
                ret_c[W - 1 - w][h] = c[h][w]
    else:
        ret_c = c
    return ret_c


def extend(R, K, H, W, c):
    if R == 90 or R == 270:
        H, W = W, H
    ret_c = [[None] * (W * K) for __ in range(H * K)]
    for h in range(H):
        for w in range(W):
            for k_h in range(K):
                for k_w in range(K):
                    ret_c[h * K + k_h][w * K + k_w] = c[h][w]
    return ret_c


def solve(R, K, H, W, c):
    rotated_c = rotate(R, H, W, c)
    ans_c = extend(R, K, H, W, rotated_c)
    ans = "\n".join(["".join(h) for h in ans_c])
    return ans


def main():
    params = read()
    print(solve(*params))


if __name__ == "__main__":
    main()
0