結果

問題 No.2112 All 2x2 are Equal
ユーザー ruthenruthen
提出日時 2022-10-28 22:24:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 2,889 ms
コンパイル使用メモリ 202,312 KB
実行使用メモリ 7,028 KB
最終ジャッジ日時 2023-09-20 05:28:01
合計ジャッジ時間 8,406 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 27 ms
4,724 KB
testcase_05 AC 34 ms
5,144 KB
testcase_06 AC 60 ms
6,764 KB
testcase_07 AC 20 ms
4,376 KB
testcase_08 AC 48 ms
5,940 KB
testcase_09 AC 4 ms
4,380 KB
testcase_10 AC 23 ms
4,376 KB
testcase_11 AC 17 ms
4,376 KB
testcase_12 AC 18 ms
4,380 KB
testcase_13 AC 53 ms
6,132 KB
testcase_14 AC 4 ms
4,376 KB
testcase_15 AC 38 ms
5,340 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 47 ms
6,028 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 5 ms
4,376 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 45 ms
6,108 KB
testcase_22 AC 4 ms
4,376 KB
testcase_23 AC 3 ms
4,380 KB
testcase_24 AC 7 ms
4,384 KB
testcase_25 AC 9 ms
4,380 KB
testcase_26 AC 7 ms
4,376 KB
testcase_27 AC 12 ms
4,380 KB
testcase_28 AC 28 ms
4,888 KB
testcase_29 AC 5 ms
4,380 KB
testcase_30 AC 20 ms
4,376 KB
testcase_31 AC 36 ms
5,076 KB
testcase_32 AC 64 ms
7,028 KB
testcase_33 AC 64 ms
7,024 KB
testcase_34 AC 64 ms
6,976 KB
testcase_35 AC 64 ms
6,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#ifdef _RUTHEN
#include <debug.hpp>
#else
#define show(...) true
#endif

using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
template <class T> using V = vector<T>;

void solve() {
    int H, W;
    cin >> H >> W;
    V<V<int>> ans(H, V<int>(W));
    int c = 1;
    rep(i, H) {
        if (i % 2 == 0) {
            rep(j, W) ans[i][j] = c++;
        } else {
            rep(j, W) ans[i][W - 1 - j] = c++;
        }
    }
    show(ans);
    cout << "Yes" << '\n';
    rep(i, H) rep(j, W) cout << (j % 2 == 1 ? ans[H - 1 - i][j] : ans[i][j]) << " \n"[j == W - 1];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int tt = 1;
    while (tt--) solve();
    return 0;
}
0