結果

問題 No.1974 2x2 Flipper
ユーザー SSRSSSRS
提出日時 2022-06-10 21:27:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 706 bytes
コンパイル時間 1,928 ms
コンパイル使用メモリ 171,772 KB
実行使用メモリ 7,636 KB
最終ジャッジ日時 2023-10-21 04:50:58
合計ジャッジ時間 6,902 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 10 ms
4,348 KB
testcase_02 AC 3 ms
4,348 KB
testcase_03 AC 48 ms
6,288 KB
testcase_04 AC 24 ms
4,860 KB
testcase_05 WA -
testcase_06 AC 35 ms
5,520 KB
testcase_07 AC 24 ms
4,864 KB
testcase_08 AC 6 ms
4,348 KB
testcase_09 AC 37 ms
5,620 KB
testcase_10 WA -
testcase_11 AC 29 ms
5,160 KB
testcase_12 AC 49 ms
6,280 KB
testcase_13 AC 31 ms
5,248 KB
testcase_14 AC 19 ms
4,616 KB
testcase_15 AC 56 ms
6,712 KB
testcase_16 WA -
testcase_17 AC 41 ms
5,828 KB
testcase_18 AC 6 ms
4,348 KB
testcase_19 AC 7 ms
4,348 KB
testcase_20 AC 22 ms
4,828 KB
testcase_21 AC 74 ms
7,636 KB
testcase_22 AC 72 ms
7,632 KB
testcase_23 AC 72 ms
7,636 KB
testcase_24 WA -
testcase_25 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
  int H, W;
  cin >> H >> W;
  vector<vector<int>> A(H, vector<int>(W, 0));
  int ans = 0;
  for (int i = 0; i < H - 1; i += 2){
    for (int j = 0; j < W - 1; j += 2){
      A[i][j] = 1;
      A[i][j + 1] = 1;
      A[i + 1][j] = 1;
      A[i + 1][j + 1] = 1;
      ans += 4;
    }
  }
  if (H >= 3 && W >= 3 && H % 2 == 1 && W % 2 == 1){
    A[H - 2][W - 2] = 0;
    A[H - 1][W - 2] = 1;
    A[H - 2][W - 1] = 1;
    A[H - 1][W - 1] = 1;
    ans += 2;
  }
  cout << ans << endl;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cout << A[i][j];
      if (j < W - 1){
        cout << ' ';
      }
    }
    cout << endl;
  }
}
0