結果

問題 No.1974 2x2 Flipper
ユーザー SSRSSSRS
提出日時 2022-06-10 21:30:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 709 bytes
コンパイル時間 5,184 ms
コンパイル使用メモリ 171,960 KB
実行使用メモリ 7,604 KB
最終ジャッジ日時 2023-10-21 04:53:02
合計ジャッジ時間 5,240 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 22 ms
4,828 KB
testcase_05 AC 13 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 21 ms
4,832 KB
testcase_08 AC 5 ms
4,348 KB
testcase_09 AC 32 ms
5,584 KB
testcase_10 AC 5 ms
4,348 KB
testcase_11 AC 26 ms
5,128 KB
testcase_12 AC 43 ms
6,248 KB
testcase_13 AC 28 ms
5,216 KB
testcase_14 AC 17 ms
4,580 KB
testcase_15 AC 49 ms
6,676 KB
testcase_16 AC 6 ms
4,348 KB
testcase_17 WA -
testcase_18 AC 6 ms
4,348 KB
testcase_19 AC 7 ms
4,348 KB
testcase_20 AC 20 ms
4,796 KB
testcase_21 WA -
testcase_22 AC 65 ms
7,596 KB
testcase_23 AC 71 ms
7,604 KB
testcase_24 AC 67 ms
7,600 KB
testcase_25 AC 1 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, 1));
  if (H % 2 == 1 && W % 2 == 0){
    A[H - 1] = vector<int>(W, 0);
  } else if (H % 2 == 0 && W % 2 == 1){
    for (int i = 0; i < H; i++){
      A[i][W - 1] = 0;
    }
  } else {
    for (int i = 0; i < max(H, W); i++){
      A[min(i, H - 1)][min(i, W - 1)] = 0;
    }
  }
  int ans = 0;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      ans += A[i][j];
    }
  }
  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