結果
| 問題 | No.565 回転拡大 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-09-09 17:20:34 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,823 bytes |
| 記録 | |
| コンパイル時間 | 1,108 ms |
| コンパイル使用メモリ | 107,880 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 09:52:14 |
| 合計ジャッジ時間 | 2,118 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;
const vector<int> COS = {1, 0, -1, 0};
const vector<int> SIN = {0, 1, 0, -1};
void rotate(vector<string>& s, int r)
{
if(r == 0)
return;
int h = s.size();
int w = s[0].size();
vector<string> t;
if(r == 180){
t.assign(h, string(w, ' '));
for(int y=0; y<h; ++y){
for(int x=0; x<w; ++x){
t[h-1-y][w-1-x] = s[y][x];
}
}
}
else{
t.assign(w, string(h, ' '));
if(r == 90){
for(int y=0; y<h; ++y){
for(int x=0; x<w; ++x){
t[x][h-1-y] = s[y][x];
}
}
}
else{
for(int y=0; y<h; ++y){
for(int x=0; x<w; ++x){
t[w-1-x][y] = s[y][x];
}
}
}
}
s.swap(t);
}
void enlarge(vector<string>& s, int k)
{
int h = s.size();
int w = s[0].size();
vector<string> t(h*k, string(w*k, ' '));
for(int y=0; y<h*k; ++y){
for(int x=0; x<w*k; ++x){
t[y][x] = s[y/k][x/k];
}
}
s.swap(t);
}
int main()
{
int r, k, h, w;
cin >> r >> k >> h >> w;
vector<string> s(h);
for(int i=0; i<h; ++i)
cin >> s[i];
rotate(s, r);
enlarge(s, k);
for(unsigned i=0; i<s.size(); ++i)
cout << s[i] << endl;
return 0;
}