結果

問題 No.1398 調和の魔法陣 (構築)
ユーザー どららどらら
提出日時 2021-02-19 22:26:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 794 bytes
コンパイル時間 1,709 ms
コンパイル使用メモリ 165,232 KB
実行使用メモリ 5,676 KB
最終ジャッジ日時 2023-10-15 03:02:01
合計ジャッジ時間 28,857 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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){
    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