結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー どららどらら
提出日時 2021-02-19 22:30:27
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 814 bytes
コンパイル時間 1,335 ms
コンパイル使用メモリ 163,852 KB
実行使用メモリ 5,720 KB
最終ジャッジ日時 2023-10-15 03:08:09
合計ジャッジ時間 25,152 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,372 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 2 ms
4,352 KB
testcase_11 WA -
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 21 ms
5,436 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 22 ms
5,392 KB
testcase_17 AC 21 ms
5,380 KB
testcase_18 AC 21 ms
5,388 KB
testcase_19 AC 21 ms
5,428 KB
testcase_20 AC 1 ms
4,348 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 1 ms
4,352 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 1 ms
4,348 KB
testcase_29 WA -
testcase_30 AC 1 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

int field[1000][1000];

int main(){
  int W, H, X;
  cin >> W >> H >> X;

  if(X > 36 || W%3!=2 || W%3!=2){
    cout << -1 << endl;
    return 0;
  }

  int a,b,c,d;
  if(X == 36){
    a = b = c = d = 9;
  }else{
    a = X%9;
    b = c = d = (X-a)/3;
  }
  
  for(int i=0; i<H; i+=3){
    for(int j=0; j<W; j+=3){
      field[i][j] = a; field[i][j+1] = b;
      field[i+1][j] = c; field[i+1][j+1] = d;
    }
  }

  rep(i,H){
    rep(j,W){
      cout << field[i][j];
    }
    cout << endl;
  }

  
  return 0;
}

0