結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー aspi
提出日時 2021-02-19 22:02:37
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 4,151 bytes
コンパイル時間 1,014 ms
コンパイル使用メモリ 108,504 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-16 19:10:21
合計ジャッジ時間 26,389 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 14 WA * 14
権限があれば一括ダウンロードができます

ソースコード

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;
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0