結果

問題 No.2112 All 2x2 are Equal
ユーザー 沙耶花沙耶花
提出日時 2022-10-28 23:27:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 914 bytes
コンパイル時間 5,057 ms
コンパイル使用メモリ 265,464 KB
実行使用メモリ 54,284 KB
最終ジャッジ日時 2023-09-20 06:44:47
合計ジャッジ時間 12,836 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 8 ms
4,872 KB
testcase_03 AC 7 ms
4,576 KB
testcase_04 AC 118 ms
24,336 KB
testcase_05 AC 156 ms
30,420 KB
testcase_06 WA -
testcase_07 AC 85 ms
18,256 KB
testcase_08 AC 216 ms
41,596 KB
testcase_09 AC 13 ms
5,952 KB
testcase_10 AC 98 ms
20,748 KB
testcase_11 AC 65 ms
15,252 KB
testcase_12 AC 80 ms
17,256 KB
testcase_13 WA -
testcase_14 AC 10 ms
5,256 KB
testcase_15 AC 168 ms
33,552 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 212 ms
40,720 KB
testcase_18 WA -
testcase_19 AC 17 ms
6,424 KB
testcase_20 AC 7 ms
4,524 KB
testcase_21 AC 210 ms
39,420 KB
testcase_22 AC 10 ms
5,204 KB
testcase_23 WA -
testcase_24 AC 24 ms
7,848 KB
testcase_25 AC 32 ms
9,276 KB
testcase_26 WA -
testcase_27 AC 50 ms
12,336 KB
testcase_28 AC 125 ms
25,440 KB
testcase_29 AC 18 ms
6,444 KB
testcase_30 AC 82 ms
18,008 KB
testcase_31 AC 163 ms
31,532 KB
testcase_32 WA -
testcase_33 AC 298 ms
54,284 KB
testcase_34 AC 300 ms
54,164 KB
testcase_35 AC 296 ms
54,132 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