結果
| 問題 | No.565 回転拡大 |
| コンテスト | |
| ユーザー |
peroon
|
| 提出日時 | 2019-06-11 09:23:21 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,920 bytes |
| 記録 | |
| コンパイル時間 | 1,971 ms |
| コンパイル使用メモリ | 175,836 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-06 01:05:15 |
| 合計ジャッジ時間 | 3,130 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
//using VV = vector<vector<ll> >;
using VV = vector<vector<char> >;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")
const ll mod = 1e9 + 7;
const ll inf = 1e18;
void vprint(vector<char> A){
ll L = A.size();
FOR(i, 0, L){
//if(i) cout << ' ';
cout << A[i];
}
cout << endl;
}
// 時計回りに回転
VV rot90(VV mat){
ll H = mat.size();
ll W = mat[0].size();
ll new_W = H;
ll new_H = W;
VV M(new_H);
FOR(y, 0, new_H){
for(ll i=H-1; i>=0; i--){
char c = mat[i][y];
M[y].push_back(c);
}
}
return M;
}
VV expand(VV m, ll scale){
ll H = m.size();
ll W = m[0].size();
ll new_H = H * scale;
ll new_W = W * scale;
VV M(new_H);
FOR(y, 0, new_H){
FOR(x, 0, new_W){
char c = m[y/scale][x/scale];
M[y].push_back(c);
}
}
return M;
}
void print_mat(VV x){
ll H = x.size();
FOR(i, 0, H){
vprint(x[i]);
}
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
// input
ll R, K, H, W;
cin >> R >> K >> H >> W;
VV mat(H);
FOR(y, 0, H){
string s; cin >> s;
mat[y].resize(s.size());
FOR(x, 0, W){
mat[y][x] = s[x];
}
}
ll rot_num = R / 90;
FOR(i, 0, rot_num){
mat = rot90(mat);
}
mat = expand(mat, K);
print_mat(mat);
return 0;
}
peroon