結果

問題 No.2112 All 2x2 are Equal
ユーザー zhtluozhtluo
提出日時 2022-10-28 21:52:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 650 bytes
コンパイル時間 2,438 ms
コンパイル使用メモリ 198,508 KB
実行使用メモリ 7,480 KB
最終ジャッジ日時 2023-09-20 04:46:57
合計ジャッジ時間 8,303 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 5 ms
4,384 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 AC 42 ms
6,648 KB
testcase_05 AC 53 ms
5,616 KB
testcase_06 AC 92 ms
7,144 KB
testcase_07 AC 30 ms
5,012 KB
testcase_08 AC 74 ms
7,420 KB
testcase_09 AC 6 ms
4,376 KB
testcase_10 AC 35 ms
5,700 KB
testcase_11 AC 24 ms
4,456 KB
testcase_12 AC 28 ms
5,776 KB
testcase_13 AC 81 ms
7,088 KB
testcase_14 AC 6 ms
4,380 KB
testcase_15 AC 58 ms
5,952 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 72 ms
6,808 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 8 ms
4,728 KB
testcase_20 AC 5 ms
5,444 KB
testcase_21 AC 70 ms
6,464 KB
testcase_22 AC 5 ms
4,380 KB
testcase_23 AC 4 ms
4,380 KB
testcase_24 AC 10 ms
5,648 KB
testcase_25 AC 13 ms
4,908 KB
testcase_26 AC 9 ms
4,380 KB
testcase_27 AC 19 ms
5,116 KB
testcase_28 AC 44 ms
6,720 KB
testcase_29 AC 10 ms
6,924 KB
testcase_30 AC 29 ms
4,672 KB
testcase_31 AC 55 ms
7,144 KB
testcase_32 AC 97 ms
7,412 KB
testcase_33 AC 97 ms
7,304 KB
testcase_34 AC 97 ms
7,396 KB
testcase_35 AC 98 ms
7,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int N, M;
int A[1010][1010];

int main() {
    scanf("%d%d", &N, &M);
    int low = 1, high = N * M;
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M; ++j) {
            if (i + j & 1) A[i][j] = low++;
            else A[i][j] = high--;
        }
    }
    for (int i = 0; i < N - 1; ++i)
        for (int j = 0; j < M - 1; ++j)
            if (A[i][j] + A[i + 1][j] + A[i][j + 1] + A[i + 1][j + 1] != A[0][0] + A[0][1] + A[1][0] + A[1][1]) {
                puts("Boom");
            }
    puts("Yes");
    for (int i = 0; i < N; ++i) for (int j = 0; j < M; ++j) printf("%d%c", A[i][j], " \n"[j + 1 == M]);
}
0