結果

問題 No.2112 All 2x2 are Equal
ユーザー ripity
提出日時 2022-10-29 23:59:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 1,939 ms
コンパイル使用メモリ 192,536 KB
最終ジャッジ日時 2025-02-08 15:52:46
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    int H, W;
    cin >> H >> W;
    int l = 1, r = H*W;
    cout << "Yes" << endl;
    for( int i = 0; i < H; i++ ) {
        for( int j = 0; j < W; j++ ) {
            if( (i+j)%2 == 0 ) {
                cout << l;
                l++;
            }else {
                cout << r;
                r--;
            }
            cout << ( j == W-1 ? '\n' : ' ' );
        }
    }
}
0