結果
問題 |
No.2112 All 2x2 are Equal
|
ユーザー |
![]() |
提出日時 | 2022-10-28 23:27:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 914 bytes |
コンパイル時間 | 4,344 ms |
コンパイル使用メモリ | 257,560 KB |
最終ジャッジ日時 | 2025-02-08 15:15:48 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 28 WA * 6 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 int main(){ int h,w; cin>>h>>w; if(h==2&&w==2){ cout<<"Yes"<<endl; cout<<"1 3"<<endl; cout<<"2 4"<<endl; return 0; } /* if(h%2==0&&w%2==0){ cout<<"No"<<endl; return 0; } */ vector a(h,vector<int> (w)); rep(i,w)a[0][i] = i; for(int i=1;i<h;i++){ a[i] = a[0]; if(i%2==1)reverse(a[i].begin(),a[i].end()); } rep(i,w){ rep(j,h){ if(i%2==0){ a[j][i] += j*w; } else{ a[h-1-j][i] += j*w; } } } cout<<"Yes"<<endl; rep(i,h){ rep(j,w){ if(j!=0)cout<<' '; cout<<a[i][j]+1; } cout<<endl; } set<int> s; rep(i,h){ rep(j,w){ s.insert(a[i][j]); } } //cout<<s.size()<<endl; return 0; }