結果

問題 No.565 回転拡大
ユーザー masamasa
提出日時 2018-02-10 16:52:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,086 bytes
コンパイル時間 748 ms
コンパイル使用メモリ 77,784 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-22 16:34:33
合計ジャッジ時間 1,822 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 2 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 1 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 2 ms
5,376 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
5,376 KB
testcase_24 WA -
testcase_25 AC 2 ms
5,376 KB
testcase_26 WA -
testcase_27 AC 2 ms
5,376 KB
testcase_28 WA -
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
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

vector<string> rotate90(vector<string> vs) {
	int h1 = vs.size();
	int w1 = vs[0].size();

	int h2 = w1;
	int w2 = h1;
	vector<string> rotated(h2, string(w2, '-'));

	for (int i = 0; i < h1; i++) {
		for (int j = 0; j < w1; j++) {
			rotated[j][i] = vs[i][j];
		}
	}
	return rotated;
}

vector<string> rotate(vector<string> vs, int r) {
	auto rotated = vs;
	for (int i = 90; i <= r; i += 90) {
		rotated = rotate90(rotated);
	}
	return rotated;
}

vector<string> enlarge(vector<string> vs, int k) {
	vector<string> large;
	for (auto s: vs) {
		string t;
		for (auto c : s) {
			t += string(k, c);
		}
		for (int i = 0; i < k; i++) {
			large.emplace_back(t);
		}
	}
	return large;
}


int main() {
	int r, h, k, w;
	cin >> r >> k >> h >> w;

	vector<string> base(h);
	for (int i = 0; i < h; i++) {
		cin >> base[i];
	}

	auto rotated = rotate(base, r);
	auto large = enlarge(rotated, k);

	for (auto s: large) {
		cout << s << endl;
	}
	return 0;
}
0