結果
| 問題 |
No.1398 調和の魔法陣 (構築)
|
| コンテスト | |
| ユーザー |
auaua
|
| 提出日時 | 2021-02-19 23:29:22 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,908 bytes |
| コンパイル時間 | 1,739 ms |
| コンパイル使用メモリ | 173,124 KB |
| 実行使用メモリ | 8,960 KB |
| 最終ジャッジ日時 | 2024-09-16 23:14:47 |
| 合計ジャッジ時間 | 24,675 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 13 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
#define vec vector<ll>
#define mat vector<vector<ll> >
#define fi first
#define se second
#define double long double
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pll;
//typedef long double ld;
typedef complex<double> Complex;
const ll INF=1e9+7;
const ll inf=INF*INF;
const ll mod=1e9+7;
const ll MAX=140010;
signed main(){
ll w,h,x;cin>>w>>h>>x;
vector<vector<ll> >ans(h+1,vector<ll>(w+1));
if(h==1){
if(x>18){
cout<<-1<<endl;
}else if(x>9){
vector<ll>ans(w);
ans[0]=9;
ans[1]=x-9;
REP(i,3,w){
ans[i]=ans[i-3];
}
rep(i,w)cout<<ans[i];
cout<<endl;
}else{
vector<ll>ans(w);
ans[0]=x;
REP(i,3,w){
ans[i]=ans[i-3];
}
rep(i,w)cout<<ans[i];
cout<<endl;
}
}else if(w==1){
swap(h,w);
if(x>18){
cout<<-1<<endl;
}else if(x>9){
vector<ll>ans(w);
ans[0]=9;
ans[1]=x-9;
REP(i,3,w){
ans[i]=ans[i-3];
}
rep(i,w)cout<<ans[i]<<endl;
cout<<endl;
}else{
vector<ll>ans(w);
ans[0]=x;
REP(i,3,w){
ans[i]=ans[i-3];
}
rep(i,w)cout<<ans[i]<<endl;
cout<<endl;
}
}else{
if(x>36||(h%3!=2)||(w%3!=2)){
cout<<-1<<endl;
}else{
vector<vector<ll> >ans(h,vector<ll>(w));
if(x>9){
ans[0][0]=9;
x-=9;
}else{
ans[0][0]=x;
x=0;
}
if(x>9){
ans[1][0]=9;
x-=9;
}else{
ans[1][0]=x;
x=0;
}
if(x>9){
ans[0][1]=9;
x-=9;
}else{
ans[0][1]=x;
x=0;
}
if(x>9){
ans[1][1]=9;
x-=9;
}else{
ans[1][1]=x;
x=0;
}
rep(i,2){
REP(j,3,w){
ans[i][j]=ans[i][j-3];
}
}
REP(i,3,h){
rep(j,w){
ans[i][j]=ans[i-3][j];
}
}
rep(i,h){
rep(j,w){
cout<<ans[i][j];
}
cout<<endl;
}
}
}
}
auaua