結果

問題 No.1974 2x2 Flipper
ユーザー tnakao0123tnakao0123
提出日時 2022-06-13 01:34:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 846 bytes
コンパイル時間 924 ms
コンパイル使用メモリ 41,824 KB
実行使用メモリ 7,168 KB
最終ジャッジ日時 2023-10-24 20:42:55
合計ジャッジ時間 5,685 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 12 ms
5,980 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 63 ms
6,988 KB
testcase_04 AC 30 ms
5,980 KB
testcase_05 WA -
testcase_06 AC 45 ms
6,012 KB
testcase_07 AC 32 ms
6,656 KB
testcase_08 AC 7 ms
5,980 KB
testcase_09 AC 48 ms
5,980 KB
testcase_10 WA -
testcase_11 AC 37 ms
5,980 KB
testcase_12 AC 64 ms
6,160 KB
testcase_13 AC 39 ms
6,324 KB
testcase_14 AC 24 ms
5,980 KB
testcase_15 AC 74 ms
6,424 KB
testcase_16 WA -
testcase_17 AC 53 ms
6,988 KB
testcase_18 AC 7 ms
4,348 KB
testcase_19 AC 8 ms
5,980 KB
testcase_20 AC 29 ms
5,980 KB
testcase_21 AC 96 ms
7,168 KB
testcase_22 AC 96 ms
7,160 KB
testcase_23 AC 96 ms
7,168 KB
testcase_24 WA -
testcase_25 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 1974.cc:  No.1974 2x2 Flipper - yukicoder
 */

#include<cstdio>
#include<algorithm>
 
using namespace std;

/* constant */

const int MAX_H = 1000;
const int MAX_W = 1000;

/* typedef */

/* global variables */

int as[MAX_H][MAX_W];

/* subroutines */

void printans(int h, int w, int c) {
  printf("%d\n", c);
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++)
      printf("%d%c", as[i][j], (j + 1 < w) ? ' ' : '\n');
}

/* main */

int main() {
  int h, w;
  scanf("%d%d", &h, &w);

  int he = h & ~1, we = w & ~1;
  int c = 0;

  for (int i = 0; i < he; i++)
    for (int j = 0; j < we; j++) as[i][j] = 1, c++;

  if (h > 1 && w > 1 && (h & w & 1)) {
    as[h - 2][w - 2] = 0; as[h - 2][w - 1] = 1;
    as[h - 1][w - 2] = 1; as[h - 1][w - 1] = 1;
    c += 2;
  }

  printans(h, w, c);
  return 0;
}
0