結果

問題 No.2112 All 2x2 are Equal
ユーザー SSRSSSRS
提出日時 2022-10-28 21:32:15
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 640 bytes
コンパイル時間 2,402 ms
コンパイル使用メモリ 168,708 KB
実行使用メモリ 7,548 KB
最終ジャッジ日時 2023-09-20 04:20:11
合計ジャッジ時間 7,663 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 4 ms
4,376 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 33 ms
4,928 KB
testcase_05 AC 42 ms
5,464 KB
testcase_06 AC 74 ms
7,016 KB
testcase_07 AC 25 ms
4,568 KB
testcase_08 AC 61 ms
6,324 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 28 ms
4,708 KB
testcase_11 AC 19 ms
4,376 KB
testcase_12 AC 23 ms
4,428 KB
testcase_13 AC 64 ms
6,616 KB
testcase_14 AC 4 ms
4,380 KB
testcase_15 AC 47 ms
5,684 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 58 ms
6,256 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 6 ms
4,380 KB
testcase_20 AC 4 ms
4,380 KB
testcase_21 AC 56 ms
6,152 KB
testcase_22 AC 4 ms
4,376 KB
testcase_23 AC 3 ms
4,380 KB
testcase_24 AC 8 ms
4,376 KB
testcase_25 AC 11 ms
4,380 KB
testcase_26 AC 8 ms
4,376 KB
testcase_27 AC 15 ms
4,380 KB
testcase_28 AC 35 ms
5,180 KB
testcase_29 AC 7 ms
4,380 KB
testcase_30 AC 24 ms
4,652 KB
testcase_31 AC 44 ms
5,544 KB
testcase_32 AC 78 ms
7,548 KB
testcase_33 AC 78 ms
7,360 KB
testcase_34 AC 80 ms
7,268 KB
testcase_35 AC 79 ms
7,296 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));
  int X = 0;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      if ((i + j) % 2 == 0){
        A[i][j] = X;
        X++;
      }
    }
  }
  for (int i = H - 1; i >= 0; i--){
    for (int j = W - 1; j >= 0; j--){
      if ((i + j) % 2 == 1){
        A[i][j] = X;
        X++;
      }
    }
  }
  cout << "Yes" << endl;
  for (int i = 0; i < H; i++){
    for (int j = 0; j < W; j++){
      cout << A[i][j] + 1;
      if (j < W - 1){
        cout << ' ';
      }
    }
    cout << endl;
  }
}
0