結果
問題 | No.565 回転拡大 |
ユーザー |
![]() |
提出日時 | 2017-09-09 13:13:58 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 2,429 bytes |
コンパイル時間 | 1,930 ms |
コンパイル使用メモリ | 173,116 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 09:14:06 |
合計ジャッジ時間 | 2,895 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------------------------- ∧_∧ ∧_∧ (´<_` ) Welcome to My Coding Space! ( ´_ゝ`) / ⌒i / \ | | / / ̄ ̄ ̄ ̄/ | __(__ニつ/ _/ .| .|____ \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ void print(vector<string> C) { int H = C.size(); rep(y, 0, H) cout << C[y] << endl; } //--------------------------------------------------------------------------------------------------- vector<string> rotate(vector<string> C, int R) { if (R == 0) return C; int H = C.size(); int W = C[0].length(); if (R == 90) { vector<string> res(W); rep(y, 0, W) { res[y] = ""; rep(x, 0, H) res[y] += C[H - 1 - x][y]; } return res; } if (R == 180) { vector<string> res(H); rep(y, 0, H) { res[y] = ""; rep(x, 0, W) res[y] += C[H - 1 - y][W - 1 - x]; } return res; } if (R == 270) { vector<string> res(W); rep(y, 0, W) { res[y] = ""; rep(x, 0, H) res[y] += C[x][W - 1 - y]; } return res; } return C; } //--------------------------------------------------------------------------------------------------- vector<string> scale(vector<string> C, int K) { int H = C.size(); int W = C[0].size(); vector<string> res(H * K); rep(y, 0, H * K) rep(x, 0, W * K) res[y] += C[y / K][x / K]; return res; } //--------------------------------------------------------------------------------------------------- void _main() { int R, K, H, W; cin >> R >> K >> H >> W; vector<string> C(H); rep(y, 0, H) cin >> C[y]; C = rotate(C, R); C = scale(C, K); print(C); }