結果

問題 No.2112 All 2x2 are Equal
ユーザー 沙耶花沙耶花
提出日時 2022-10-28 23:26:03
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 906 bytes
コンパイル時間 4,709 ms
コンパイル使用メモリ 266,416 KB
実行使用メモリ 54,172 KB
最終ジャッジ日時 2023-09-20 06:42:40
合計ジャッジ時間 11,489 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 8 ms
4,804 KB
testcase_03 AC 7 ms
4,612 KB
testcase_04 AC 116 ms
24,052 KB
testcase_05 AC 151 ms
30,456 KB
testcase_06 WA -
testcase_07 AC 82 ms
18,212 KB
testcase_08 AC 216 ms
41,844 KB
testcase_09 AC 12 ms
5,668 KB
testcase_10 AC 96 ms
20,812 KB
testcase_11 AC 66 ms
15,200 KB
testcase_12 AC 79 ms
17,404 KB
testcase_13 WA -
testcase_14 AC 10 ms
5,172 KB
testcase_15 AC 169 ms
33,564 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 216 ms
40,772 KB
testcase_18 WA -
testcase_19 AC 16 ms
6,420 KB
testcase_20 AC 7 ms
4,416 KB
testcase_21 AC 203 ms
39,264 KB
testcase_22 AC 10 ms
5,124 KB
testcase_23 WA -
testcase_24 AC 23 ms
7,556 KB
testcase_25 AC 31 ms
9,200 KB
testcase_26 WA -
testcase_27 AC 48 ms
12,392 KB
testcase_28 AC 123 ms
25,548 KB
testcase_29 AC 17 ms
6,364 KB
testcase_30 AC 82 ms
18,116 KB
testcase_31 AC 159 ms
31,644 KB
testcase_32 WA -
testcase_33 AC 289 ms
54,172 KB
testcase_34 AC 293 ms
54,168 KB
testcase_35 AC 287 ms
54,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0