結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー 沙耶花沙耶花
提出日時 2021-02-19 21:31:22
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 603 bytes
コンパイル時間 2,211 ms
コンパイル使用メモリ 201,980 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-10-14 23:59:10
合計ジャッジ時間 25,558 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000



int main(){
	
	int W,H,X;
	cin>>W>>H>>X;
	
	if(W%3!=2||H%3!=2){
		cout<<-1<<endl;
		return 0;
	}
	
	if(X>36){
		cout<<-1<<endl;
	}
	
	vector<int> cnt(4,0);
	rep(i,4){
		if(X<=9){
			cnt[i] = X;
			break;
		}
		else{
			cnt[i] = 9;
			X -= 9;
		}
	}
	
	vector<string> ans(H,string(W,'0'));
	
	rep(i,H){
		rep(j,W){
			int x = i%3,y = j%3;
			
			if(x<=1&&y<=1){
				ans[i][j] = '0' + (cnt[x*2+y]);
			}
		}
	}
	
	rep(i,H){
		cout<<ans[i]<<endl;
	}
	
    return 0;
}
0