結果

問題 No.2112 All 2x2 are Equal
ユーザー HIcoderHIcoder
提出日時 2023-07-13 16:24:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 1,247 bytes
コンパイル時間 1,175 ms
コンパイル使用メモリ 112,004 KB
実行使用メモリ 7,560 KB
最終ジャッジ日時 2023-10-13 05:29:31
合計ジャッジ時間 6,608 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 4 ms
4,352 KB
testcase_03 AC 3 ms
4,352 KB
testcase_04 AC 32 ms
4,968 KB
testcase_05 AC 40 ms
5,400 KB
testcase_06 AC 71 ms
7,104 KB
testcase_07 AC 24 ms
4,456 KB
testcase_08 AC 57 ms
6,388 KB
testcase_09 AC 5 ms
4,352 KB
testcase_10 AC 27 ms
4,788 KB
testcase_11 AC 19 ms
4,348 KB
testcase_12 AC 22 ms
4,520 KB
testcase_13 AC 63 ms
6,824 KB
testcase_14 AC 4 ms
4,352 KB
testcase_15 AC 45 ms
5,684 KB
testcase_16 AC 2 ms
4,352 KB
testcase_17 AC 56 ms
6,388 KB
testcase_18 AC 3 ms
4,348 KB
testcase_19 AC 6 ms
4,352 KB
testcase_20 AC 3 ms
4,348 KB
testcase_21 AC 54 ms
6,292 KB
testcase_22 AC 4 ms
4,352 KB
testcase_23 AC 4 ms
4,348 KB
testcase_24 AC 8 ms
4,352 KB
testcase_25 AC 10 ms
4,348 KB
testcase_26 AC 8 ms
4,352 KB
testcase_27 AC 14 ms
4,348 KB
testcase_28 AC 33 ms
5,064 KB
testcase_29 AC 6 ms
4,348 KB
testcase_30 AC 23 ms
4,484 KB
testcase_31 AC 43 ms
5,596 KB
testcase_32 AC 75 ms
7,560 KB
testcase_33 AC 75 ms
7,408 KB
testcase_34 AC 75 ms
7,244 KB
testcase_35 AC 76 ms
7,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*

AC


A={
1 20 ? ? 
18 4 ? ?
?  ? ? ?
?  ? ? ?
}

のときに 
A[0][2]=A[0][0]+1
A[1][2]=A[1][0]-1
がくればよさそう
A[0][2+1]=A[0][1]-1
A[1][2+1]=A[1][1]+1
がくればよさそう

同様に縦の移動も
A[2][0]=A[0][0]+W
A[2][1]=A[0][1]-W


A[2+1][0]=A[1][0]-W
A[2+1][1]=A[1][1]+W


A[0][0],A[0][1],A[1][0],A[1][1]について

最小と最大と (最小-H),(最大+H)があればよさそう



*/
#include<iostream>
#include<set>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<map>
#include<numeric>
#include<queue>
#include<cmath>
#include <unordered_set>
using namespace std;
typedef long long ll;
const ll INF=1LL<<60;
typedef pair<int,int> P;
typedef pair<int,P> PP;
const ll MOD=998244353;
int main(){
    int H,W;
    cin>>H>>W;

    vector<vector<int>> ans(H,vector<int>(W,0));

    int c1=0,c2=0;

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if((i+j)%2==0){
                c1++;
                ans[i][j]=c1;
            }else{
                c2++;
                ans[i][j]=H*W+1-c2;
            }
        }
    }

    cout<<"Yes"<<endl;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cout<<ans[i][j]<<(j==W-1?'\n':' ');
        }   
    }


}
0