結果

問題 No.1434 Make Maze
ユーザー 夜
提出日時 2021-03-19 22:41:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,376 bytes
コンパイル時間 1,873 ms
コンパイル使用メモリ 93,676 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-29 17:59:16
合計ジャッジ時間 5,532 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 17 ms
5,376 KB
testcase_03 AC 18 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 6 ms
5,376 KB
testcase_16 AC 4 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 11 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 8 ms
5,376 KB
testcase_25 AC 12 ms
5,376 KB
testcase_26 AC 3 ms
5,376 KB
testcase_27 AC 8 ms
5,376 KB
testcase_28 AC 3 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 4 ms
5,376 KB
testcase_31 AC 4 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
char ans[1010][1010];
int main() {
	int h, w, x;
	cin >> h >> w >> x;
	bool bo = true;
	if (h > w) {
		swap(h, w);
		bo = false;
	}
	if (h + w - 2 <= x && w * (h + 1) / 2 + h / 2 >= x) {
		if ((h + w - 2) % 4 == x % 4) {
			int now = h + w - 2;
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					if (j == 0 || i%2==0) {
						ans[i][j] = '.';
					}
					else {
						ans[i][j] = '#';
					}
				}
			}
			for (int i = 0; i < h - 1; i += 4) {
				for (int j = 1; j < w; j += 2) {
					if (now < x) {
						ans[i + 1][j - 1] = '#';
						ans[i][j] = '.';
						ans[i][j + 1] = '.';
						ans[i + 1][j + 1] = '.';
						ans[i + 2][j + 1] = '.';
						ans[i + 2][j] = '.';
						now += 4;
					}
				}
			}
			if (!bo) {
				for (int i = 0; i < w; i++) {
					for (int j = 0; j < h; j++) {
						cout << ans[j][i];
					}
					cout << endl;
				}
			}
			else {
				for (int i = 0; i < h; i++) {
					for (int j = 0; j < w; j++) {
						cout << ans[i][j];
					}
					cout << endl;
				}
			}
		}
		else {
			cout << -1 << endl;
		}
	}
	else {
		cout << -1 << endl;
	}
}
0