結果

問題 No.2112 All 2x2 are Equal
ユーザー HaaHaa
提出日時 2022-10-28 22:02:55
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 948 bytes
コンパイル時間 3,401 ms
コンパイル使用メモリ 170,108 KB
実行使用メモリ 11,176 KB
最終ジャッジ日時 2023-09-20 05:00:53
合計ジャッジ時間 8,269 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 4 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 35 ms
6,132 KB
testcase_05 AC 42 ms
7,192 KB
testcase_06 AC 73 ms
10,352 KB
testcase_07 AC 24 ms
5,440 KB
testcase_08 AC 58 ms
8,896 KB
testcase_09 AC 5 ms
4,376 KB
testcase_10 AC 28 ms
5,600 KB
testcase_11 AC 19 ms
4,820 KB
testcase_12 AC 24 ms
5,104 KB
testcase_13 AC 64 ms
9,648 KB
testcase_14 AC 4 ms
4,376 KB
testcase_15 AC 52 ms
7,712 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 57 ms
9,024 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 6 ms
4,380 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 63 ms
8,528 KB
testcase_22 AC 4 ms
4,376 KB
testcase_23 AC 3 ms
4,376 KB
testcase_24 AC 8 ms
4,376 KB
testcase_25 AC 10 ms
4,380 KB
testcase_26 AC 8 ms
4,376 KB
testcase_27 AC 16 ms
4,776 KB
testcase_28 AC 39 ms
6,440 KB
testcase_29 AC 6 ms
4,376 KB
testcase_30 AC 23 ms
5,476 KB
testcase_31 AC 44 ms
7,212 KB
testcase_32 AC 77 ms
10,880 KB
testcase_33 AC 78 ms
10,964 KB
testcase_34 AC 91 ms
11,176 KB
testcase_35 AC 77 ms
10,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
template<typename T> bool chmax(T &x, const T &y) {return (x<y)?(x=y,true):false;};
template<typename T> bool chmin(T &x, const T &y) {return (x>y)?(x=y,true):false;};
constexpr ll MOD=998244353;
constexpr ll INF=2e18;

int main(){
    int h, w; cin >> h >> w;
    bool f=0;
    if(h%2==1&&w%2==0){
        f=1;
        swap(h,w);
    }
    VVI ans(h+1,VI(w));
    int l=1, r=h*w;
    REP(i,(h+1)/2){
        REP(j,w){
            int x=j%2==1;
            int y=j%2==0;
            ans[i*2+x][j]=l++;
            ans[i*2+y][j]=r--;
        }
    }
    cout << "Yes" << endl;
    if(!f)
        REP(i,h)REP(j,w) cout << ans[i][j] << " \n"[j==w-1];
    else
        REP(i,w)REP(j,h) cout << ans[j][i] << " \n"[j==h-1];
    return 0;
}
0