結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー 👑 NachiaNachia
提出日時 2021-02-19 21:39:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 3,153 ms
コード長 505 bytes
コンパイル時間 2,538 ms
コンパイル使用メモリ 202,908 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-15 00:21:16
合計ジャッジ時間 25,870 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int W,H,X;
int C[3][3]={};
vector<int> PV[3]={{1},{0},{0,1}};

int main(){
 cin>>W>>H>>X;
 vector<int> S,PX=PV[W%3],PY=PV[H%3];
 while(X>0){ S.push_back(min(X,9)); X-=S.back(); }
 if(S.size()>PX.size()*PY.size()){ cout<<-1<<endl; return 0; }
 while(S.size()<PX.size()*PY.size()) S.push_back(0);
 int i=0; for(int x:PX) for(int y:PY) C[x][y]=S[i++];
 rep(y,H){ rep(x,W) cout<<C[x%3][y%3]; cout<<endl; }
 return 0;
}

0