結果

問題 No.565 回転拡大
ユーザー rpy3cpprpy3cpp
提出日時 2017-09-09 09:10:50
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,425 bytes
コンパイル時間 1,892 ms
コンパイル使用メモリ 168,300 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 23:35:12
合計ジャッジ時間 2,985 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'std::vector<std::__cxx11::basic_string<char> > Rotate(const std::vector<std::__cxx11::basic_string<char> >&, int)':
main.cpp:23:1: warning: control reaches end of non-void function [-Wreturn-type]
   23 | }
      | ^

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

void print(const vector<string> & data){
    for (auto &row : data) cout << row << endl;
}

vector<string> Rotate(const vector<string> & src, int R){
    if (R == 0) return src;
    if (R == 90){
        int n_row = src.size();
        int n_col = src[0].size();
        vector<string> dst(n_col, string(n_row, 'x'));
        for (int r = 0; r != n_row; ++r){
            for (int c = 0; c != n_col; ++c){
                dst[c][n_row - 1 - r] = src[r][c];
            }
        }
        return dst;
    }
    if (R == 180) return Rotate(Rotate(src, 90), 90);
    if (R == 280) return Rotate(Rotate(src, 180), 90);
}

vector<string> Enlarge(vector<string> src, int K){
    int n_row = src.size();
    int n_col = src[0].size();
    vector<string> dst(n_row * K, string(n_col * K, 'x'));
    for (int r = 0; r != n_row; ++r){
        for (int c = 0; c != n_col; ++c){
            for (int kr = 0; kr != K; ++kr){
                for (int kc = 0; kc != K; ++kc){
                    dst[r * K + kr][c * K + kc] = src[r][c];
                }
            }
        }
    }
    return dst;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int R, K, H, W;
    cin >> R >> K >> H >> W;
    vector<string> cs(H, string());
    for (auto & row : cs) cin >> row;
    auto rotated = Rotate(cs, R);
    auto ans = Enlarge(rotated, K);
    print(ans);
    return 0;
}

0