結果
問題 | No.1974 2x2 Flipper |
ユーザー |
![]() |
提出日時 | 2022-06-13 01:34:33 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 846 bytes |
コンパイル時間 | 315 ms |
コンパイル使用メモリ | 41,924 KB |
実行使用メモリ | 7,016 KB |
最終ジャッジ日時 | 2024-09-24 15:53:11 |
合計ジャッジ時間 | 4,670 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 21 WA * 4 |
ソースコード
/* -*- 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; }