結果
| 問題 | No.1434 Make Maze | 
| コンテスト | |
| ユーザー |  uzzy | 
| 提出日時 | 2021-03-19 22:55:31 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 13 ms / 2,000 ms | 
| コード長 | 1,353 bytes | 
| コンパイル時間 | 2,659 ms | 
| コンパイル使用メモリ | 184,844 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-24 21:39:24 | 
| 合計ジャッジ時間 | 6,501 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 30 | 
ソースコード
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
#include<bits/stdc++.h>
//#include<atcoder/all>
//using namespace atcoder;
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please
bool kotae[1000][1000];
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int H, W, X;
	cin >> H >> W >> X;
	int mi = H + W - 2;
	int ma = mi + (H / 2) * (W / 2) / 2 * 4;
	if (X < mi || ma < X || (X - mi) % 4) {
		co(-1);
		return 0;
	}
	int K = (X - mi) / 4;
	for (int i = 1; i < H; i += 2) rep(j, W - 1) {
		kotae[i][j] = 1;
	}
	for (int i = 3; i < H; i += 4) {
		for (int j = W - 3; j >= 0; j -= 2) {
			if (K) {
				kotae[i][j] = 0;
				kotae[i][j + 2] = 1;
				K--;
			}
		}
	}
	for (int j = W - 2; j >= 3; j -= 4) {
		if (K) {
			kotae[H - 1][j] = 1;
			kotae[H - 2][j - 1] = 0;
			kotae[H - 3][j - 2] = 1;
			kotae[H - 2][j - 3] = 0;
			K--;
		}
	}
	rep(i, H) {
		rep(j, W) {
			cout << (kotae[i][j] ? '#' : '.');
		}
		cout << '\n';
	}
	Would you please return 0;
}
            
            
            
        