結果

問題 No.2256 Step by Step
ユーザー shobonvipshobonvip
提出日時 2023-01-28 02:52:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 2,442 bytes
コンパイル時間 1,412 ms
コンパイル使用メモリ 86,764 KB
実行使用メモリ 76,120 KB
最終ジャッジ日時 2023-09-10 19:39:43
合計ジャッジ時間 6,197 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
70,840 KB
testcase_01 AC 74 ms
70,648 KB
testcase_02 AC 84 ms
75,752 KB
testcase_03 AC 82 ms
75,432 KB
testcase_04 AC 84 ms
75,800 KB
testcase_05 AC 83 ms
75,780 KB
testcase_06 AC 74 ms
70,776 KB
testcase_07 AC 74 ms
70,552 KB
testcase_08 AC 73 ms
70,924 KB
testcase_09 WA -
testcase_10 AC 75 ms
70,768 KB
testcase_11 AC 75 ms
70,424 KB
testcase_12 AC 80 ms
75,440 KB
testcase_13 AC 83 ms
76,068 KB
testcase_14 AC 74 ms
70,888 KB
testcase_15 AC 79 ms
75,800 KB
testcase_16 AC 75 ms
70,588 KB
testcase_17 AC 82 ms
76,120 KB
testcase_18 AC 83 ms
75,808 KB
testcase_19 AC 82 ms
75,876 KB
testcase_20 AC 79 ms
76,056 KB
testcase_21 AC 79 ms
75,800 KB
testcase_22 AC 82 ms
75,792 KB
testcase_23 AC 74 ms
70,544 KB
testcase_24 AC 80 ms
75,632 KB
testcase_25 AC 80 ms
75,796 KB
testcase_26 AC 83 ms
75,784 KB
testcase_27 AC 81 ms
75,728 KB
testcase_28 AC 75 ms
70,616 KB
testcase_29 AC 76 ms
71,024 KB
testcase_30 AC 81 ms
75,776 KB
testcase_31 AC 74 ms
70,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

#繰り返し前のテンプレ
tenple = [
	[0, 1, 1, 4, 2, 1],
	[2, 3, 3, 4, 3, 0],
	[4, 2, 0]
]

# 基本の繰り返し系
rep = [
	[2, 1, 0],
	[1, 3, 3, 2, 3, 0],
	[2, 1, 4, 5, 0, 6],
	[4, 6, 8, 5, 8, 8],
	[5, 4, 6]
]

#終了 (n%4 == 1)
rep2 = [
	[0, 1, 2],
	[2, 3, 3, 0, 1, 3],
	[1, 4, 4, 0, 4, 2]
]

#終了 (n%4 == 2)
rep3 = [
	[0, 1, 2],
	[0, 3, 1, 4, 2, 5],
	[0, 3, 1, 4, 2, 5],
	[3, 4, 5, 6, 6, 6]
]

#終了 (n%4 == 0)
rep4 = [
	[0, 1, 2],
	[0, 2, 3, 3, 1, 3],
	[0, 4, 1, 9, 5, 2],
	[5, 8, 9, 0, 4, 6],
	[5, 8, 9, 0, 4, 6],
	[6, 7, 8, 0, 7, 7]
]

if n == 1:
	print("1\n0\n0\n0\n1\n1")
elif n == 2:
	print("-1")
elif n == 3:
	print("012\n345\n345\n225\n141\n300")
elif n == 4:
	print("4551\n3662\n6777\n3005\n3442\n0112")
elif n == 5:
	print("79142\n80653\n80453\n90966\n87754\n11223")
elif n == 6:
	print("022586\n133097\n166600\n244397\n455898\n100667")
elif n % 4 == 3:
	a = [[] for i in range(n)]
	a[0] = tenple[0]
	a[1] = tenple[1]
	a[2] = tenple[2]
	now = 5
	piv = 2
	while piv < n - 1:
		for j in range(5):
			for l in rep[j]:
				a[piv+j].append((l+now)%10)
		now += 9
		piv += 4
	a[n-1].append(now%10)
	a[n-1].append(now%10)
	a[n-1].append(now%10)
	r = ["".join([str(a[i][j]) for i in range(n)]) for j in range(6)]
	print(*r,sep="\n")
elif n % 4 == 1:
	a = [[] for i in range(n)]
	a[0] = tenple[0]
	a[1] = tenple[1]
	a[2] = tenple[2]
	now = 5
	piv = 2
	while piv < n - 3:
		for j in range(5):
			for l in rep[j]:
				a[piv+j].append((l+now)%10)
		now += 9
		piv += 4
	for j in range(3):
		for l in rep2[j]:
			a[piv+j].append((l+now)%10)
	r = ["".join([str(a[i][j]) for i in range(n)]) for j in range(6)]
	print(*r,sep="\n")
elif n % 4 == 2:
	a = [[] for i in range(n)]
	a[0] = tenple[0]
	a[1] = tenple[1]
	a[2] = tenple[2]
	now = 5
	piv = 2
	while piv < n - 4:
		for j in range(5):
			for l in rep[j]:
				a[piv+j].append((l+now)%10)
		now += 9
		piv += 4
	for j in range(4):
		for l in rep3[j]:
			a[piv+j].append((l+now)%10)
	r = ["".join([str(a[i][j]) for i in range(n)]) for j in range(6)]
	print(*r,sep="\n")
elif n % 4 == 0:
	a = [[] for i in range(n)]
	a[0] = tenple[0]
	a[1] = tenple[1]
	a[2] = tenple[2]
	now = 5
	piv = 2
	while piv < n - 9:
		for j in range(5):
			for l in rep[j]:
				a[piv+j].append((l+now)%10)
		now += 9
		piv += 4
	for j in range(6):
		for l in rep4[j]:
			a[piv+j].append((l+now)%10)
	r = ["".join([str(a[i][j]) for i in range(n)]) for j in range(6)]
	print(*r,sep="\n")
0