結果

問題 No.2112 All 2x2 are Equal
ユーザー publflpublfl
提出日時 2022-10-28 22:01:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 562 bytes
コンパイル時間 1,684 ms
コンパイル使用メモリ 48,700 KB
実行使用メモリ 8,604 KB
最終ジャッジ日時 2023-09-20 04:59:52
合計ジャッジ時間 6,340 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 4 ms
4,380 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 AC 39 ms
6,780 KB
testcase_05 AC 51 ms
6,792 KB
testcase_06 AC 87 ms
8,396 KB
testcase_07 AC 29 ms
5,008 KB
testcase_08 AC 72 ms
8,588 KB
testcase_09 AC 6 ms
4,380 KB
testcase_10 AC 33 ms
5,776 KB
testcase_11 AC 23 ms
4,376 KB
testcase_12 AC 28 ms
5,900 KB
testcase_13 AC 78 ms
8,100 KB
testcase_14 AC 5 ms
4,380 KB
testcase_15 AC 56 ms
7,104 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 69 ms
7,936 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 7 ms
4,380 KB
testcase_20 AC 5 ms
5,068 KB
testcase_21 AC 66 ms
7,732 KB
testcase_22 AC 5 ms
4,380 KB
testcase_23 AC 4 ms
4,380 KB
testcase_24 AC 10 ms
5,260 KB
testcase_25 AC 13 ms
4,600 KB
testcase_26 AC 9 ms
4,384 KB
testcase_27 AC 19 ms
4,864 KB
testcase_28 AC 42 ms
6,752 KB
testcase_29 AC 9 ms
6,532 KB
testcase_30 AC 28 ms
4,824 KB
testcase_31 AC 55 ms
8,372 KB
testcase_32 AC 94 ms
8,540 KB
testcase_33 AC 94 ms
8,604 KB
testcase_34 AC 93 ms
8,596 KB
testcase_35 AC 94 ms
8,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <vector>

std::vector<int> V;
int ans[1010][1010];
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	int C = 1;
	for(int i=1;i<=a;i++) for(int j=1;j<=b;j++) ans[i][j] = C++;
	
	for(int i=1;i<=a;i++)
	{
		for(int j=1;j<=b;j++)
		{
			if((i+j)%2==0) V.push_back(ans[i][j]);
		}
	}
	for(int i=1;i<=a;i++)
	{
		for(int j=1;j<=b;j++)
		{
			if((i+j)%2==0)
			{
				ans[i][j] = V.back();
				V.pop_back();
			}
		}
	}
	
	printf("Yes\n");
	for(int i=1;i<=a;i++)
	{
		for(int j=1;j<=b;j++)
		{
			printf("%d ",ans[i][j]);
		}
		printf("\n");
	}
}
0