結果

問題 No.565 回転拡大
ユーザー Mister
提出日時 2020-04-15 22:29:06
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 968 bytes
コンパイル時間 930 ms
コンパイル使用メモリ 79,744 KB
最終ジャッジ日時 2025-01-09 19:20:57
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>

template <class T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }

void solve() {
    int r, k, h, w;
    std::cin >> r >> k >> h >> w;

    auto ss = vec(h, vec(w, '*'));
    for (auto& s : ss) {
        for (auto& c : s) std::cin >> c;
    }

    r /= 90;
    while (r--) {
        auto nss = vec(w, vec(h, '*'));
        for (int x = 0; x < h; ++x) {
            for (int y = 0; y < w; ++y) {
                nss[y][x] = ss[x][y];
            }
        }

        std::swap(ss, nss);
        for (auto& s : ss) std::reverse(s.begin(), s.end());
        std::swap(h, w);
    }

    for (int x = 0; x < h * k; ++x) {
        for (int y = 0; y < w * k; ++y) {
            std::cout << ss[x / k][y / k];
        }
        std::cout << std::endl;
    }
}

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0