結果
問題 | No.2112 All 2x2 are Equal |
ユーザー |
![]() |
提出日時 | 2022-10-28 23:39:07 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 87 ms / 2,000 ms |
コード長 | 663 bytes |
コンパイル時間 | 1,956 ms |
コンパイル使用メモリ | 193,228 KB |
最終ジャッジ日時 | 2025-02-08 15:20:53 |
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; #include<bits/stdc++.h> using namespace std; int G[1010][1010]; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); int h,w; cin>>h>>w; cout<<"Yes"<<endl; int ni=0,nj=0; bool b=false; int now=1; rep(i,h) rep(j,w){ if(i%2==0 && j%2==1) continue; if(i%2==1 && j%2==0) continue; G[i][j]=now; now++; } now=h*w; rep(i,h) rep(j,w){ if(G[i][j]) continue; G[i][j]=now; now--; } rep(i,h){ rep(j,w){ if(j) cout<<" "; cout<<G[i][j]; } cout<<'\n'; } return 0; }