結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー aspiaspi
提出日時 2021-02-19 22:02:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 4,151 bytes
コンパイル時間 1,114 ms
コンパイル使用メモリ 106,636 KB
実行使用メモリ 6,208 KB
最終ジャッジ日時 2023-10-15 01:39:17
合計ジャッジ時間 27,239 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#include <ctime>
#include <stdlib.h>
#include <math.h>
#include <numeric>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <stdio.h>
using namespace std;

/*
#include <atcoder/all>
using namespace atcoder;
using mf_edge = mf_graph<int>::edge;

#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
namespace mp = boost::multiprecision;
*/

/*
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
*/
#define int long long
#define endl "\n"
#define ALL(v)  v.begin(),v.end()
#define m_p make_pair
#define m_t make_tuple
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
using P = pair<int, int>;
using ld = long double;
using ll = long long;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VVVI = vector<vector<vector<int>>>;
using VD = vector<double>;
using VP = vector<pair<int, int>>;
using VVP = vector<vector<pair<int, int>>>;
using VC = vector<char>;
using VVC = vector<vector<char>>;
template<class T> using invPQ = priority_queue<T, vector<T>, greater<T>>;
template<class T> using PQ = priority_queue<T>;

constexpr double pai = 3.14159265358979323846;
constexpr int INF = 1070000000;
constexpr long long LINF = 4611686015206162431;
const long long mod = 998244353;
const long long MOD = mod;
constexpr double PI = 3.1415926;
const vector<int> ver = { 1,0,-1,0 }, sid{ 0,1,0,-1 };

struct edge {
	int to, cost;
};
edge m_e(int xx, int yy) {
	edge ed;
	ed.to = xx;
	ed.cost = yy;
	return ed;
}



template<class T>void vecin(vector<T>& v) { for (int i = 0; i < (int)v.size(); i++) cin >> v[i]; }

template<class T>bool chmax(T& xx, T yy) { if (xx < yy) { xx = yy; return true; }return false; }
template<class T>bool chmin(T& xx, T yy) { if (xx > yy) { xx = yy; return true; }return false; }
//ソートされた配列でx未満の要素の数を返す二分探索関数
int b_s(vector<int>& vec, int xx) { return upper_bound(ALL(vec), xx) - vec.begin(); }
int gcd(int xx, int yy) {
	if (yy > xx)swap(xx, yy);
	while (xx % yy != 0) {
		xx %= yy;
		swap(xx, yy);
	}
	return yy;
}
int lcm(int xx, int yy) { return (xx / gcd(xx, yy)) * yy; }
bool prime(int xx) {//O(sqrt(N))
	if (xx <= 1)return 0;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0)return 0;
	}
	return 1;
}
int ceilinv(int xx, int yy) {
	assert(yy);
	if (xx % yy == 0)return xx / yy;
	else return xx / yy + 1;
}

template<class T, class Fn, class e>class slow_segment_tree {
	struct node {
		T sum;
		node* child[2];
	};
	node* root = NULL;
	int depth = 0;
	void make_node(node*& n, int d) {
		n = new node;
		if (d > 1) {
			make_node(n.child[0], d - 1);
			make_node(n.child[1], d - 1);
		}
	}
	void set_sub(node np, int& x, T n,int p) {//ポインタ 位置 変更する数値 深さ
		
	}
	
	T prod_sub(node np, int r, int l, int& a, int& b) {
		
	}
	

	slow_segment_tree(int N) {
		while ((1U << depth) < (unsigned int)(N)) depth++;
		make_node(root, depth);
	}
	void set(int x, T n) {

	}
	T prod(int r,int l) {// [r, l)

	}
};

signed main() {
	ios::sync_with_stdio(false); std::cin.tie(nullptr);
	int H, W, X;
	cin >> H >> W >> X;
	VVI vec(H, VI(W));

	if (H * W * 9 < X)return 0;
	if (H < 3 && W < 3) {
		int t = X;
		rep(i, H) {
			rep(j, W) {
				cout << max(0ll, min(t, 9ll));
				t -= max(0ll, min(t, 9ll));
			}
			cout << endl;
		}
		return 0;
	}
	if (H % 3 != 2 || W % 3 != 2 || X > 36) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = 1; i < H; i += 3) {
		for (int j = 1; j < W; j += 3) {
			vec[i][j] = max(0ll,min(X, 9ll));
			vec[i][j - 1] = max(0ll,min(X - 9, 9ll));
			vec[i - 1][j] = max(0ll,min(X - 18, 9ll));
			vec[i - 1][j - 1] = max(0ll , min(X - 27, 9ll));
		}
	}
	rep(i, H) {
		rep(j, W) {
			cout << vec[i][j];
		}
		cout << endl;
	}
}
0