結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー Example0911Example0911
提出日時 2021-02-20 08:53:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,130 bytes
コンパイル時間 3,837 ms
コンパイル使用メモリ 206,720 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-17 12:44:32
合計ジャッジ時間 29,928 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;

using ll = long long;
using P = pair<ll, ll>;
const ll INF = (1LL << 61);
ll mod = 998244353;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int W, H, X; cin >> W >> H >> X;
	vector<vector<ll>>ans(3, vector<ll>(3));
	for (int i = 0; i <= 9; i++) {
		for (int j = 0; j <= 9; j++) {
			for (int k = 0; k <= 9; k++) {
				for (int l = 0; l <= 9; l++) {
					bool ok = true;
					ans[0][0] = i, ans[0][1] = j, ans[1][0] = k, ans[1][1] = l;
					for (int a = 0; a < 3; a++) {
						for (int b = 0; b < 3; b++) {
							int now = 0;
							for (int da = -1; da <= 1; da++) {
								for (int db = -1; db <= 1; db++) {
									int na = a + da, nb = b + db;
									if (0 <= na && na < 3 && 0 <= nb && nb < 3) {
										now += ans[na][nb];
									}
								}
							}
							if (now != X) {
								ok = false;
							}
						}
					}
					if (ok) {
						for (int a = 0; a < H; a++) {
							for (int b = 0; b < W; b++) {
								cout << ans[a % 3][b % 3];
							}
							cout << endl;
						}
						return 0;
					}
				}
			}
		}
	}
	cout << -1 << endl;
	return 0;
}
0