結果

問題 No.565 回転拡大
ユーザー snrnsidy
提出日時 2025-09-14 23:42:17
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,477 bytes
コンパイル時間 1,759 ms
コンパイル使用メモリ 201,608 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-09-14 23:42:21
合計ジャッジ時間 3,312 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

vector <string> rorate(vector <string> board)
{
    int n = board.size();
    int m = board[0].size();
    vector <string> res;
    for(int i=0;i<m;i++)
    {
        string x;
        for(int j=0;j<n;j++)
        {
            x += 'a';
        }
        res.push_back(x);
    }
    for(int i=0;i<m;i++)
    {
        for(int j=0;j<n;j++)
        {
            res[i][j] = board[j][m-1-i];
        }
    }

    return res;
}
int main(void) 
{
	cin.tie(0);
	ios::sync_with_stdio(false);

    vector <string> S;
    string s;
    int R,K,H,W;
    cin >> R >> K;
    cin >> H >> W;

    for(int i=0;i<H;i++)
    {
        cin >> s;
        S.push_back(s);
    }

    R = 360 - R;
    R%=360;
    for(int r=0;r<R/90;r++)
    {
        S = rorate(S);
    }

    H = S.size();
    W = S[0].size();
    vector <string> res;
    for(int i=0;i<H*K;i++)
    {
        string s = "";
        for(int j=0;j<W*K;j++)
        {
            s += ' ';
        }
        res.push_back(s);
    }

    for(int i=0;i<H;i++)
    {
        for(int j=0;j<W;j++)
        {
            int y1 = i*K;
            int x1 = j*K;
            int y2 = y1 + K;
            int x2 = x1 + K;
            for(int y=y1;y<y2;y++)
            {
                for(int x=x1;x<x2;x++)
                {
                    res[y][x] = S[i][j];
                }
            }
        }
    }

    for(auto x : res)
    {
        cout << x << '\n';
    }
	return 0;
}
0