結果

問題 No.3744 XY Tiling
コンテスト
ユーザー sig
提出日時 2026-09-19 14:19:25
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 1,168 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 73 ms
コンパイル使用メモリ 81,024 KB
実行使用メモリ 86,784 KB
最終ジャッジ日時 2026-09-19 14:19:32
合計ジャッジ時間 5,135 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
サブタスク 配点 結果
部分点 60 % AC * 15 WA * 4
満点 40 % AC * 22 WA * 38
合計 5 * 0% = 0 点
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

h,w = map(int, input().split())
hw = 0
if h > w:
	hw = True
	h,w = w,h
ans = []
h1,h2,w1,w2 = 1,h,1,w
an = 2
def f1(h1,h2,w1,w2,c):
	for i in range(w1,w2-1):
		ans.append([h1,i,c,h1+1,i,1])
	for i in range(h1,h2-1):
		ans.append([i,w2-1,c,i,w2,1])
def f2(h1,h2,w1,w2,c):
	for i in range(w1+2,w2+1):
		ans.append([h2-1,i,1,h2,i,c])
	for i in range(h1+2,h2+1):
		ans.append([i,w1,1,i,w1+1,c])

def f44(h1,w1,c1,c2):
	for i in range(4):
		ans.append([h1+i,w1,c1,h1+i,w1+1,1])
		ans.append([h1+i,w1+2,1,h1+i,w1+3,c2])
tf = True
while (h2-h1) >= 3 and (w2-w1) >= 3:
	an = 3
	if (h2-h1) == 3 and (w2-w1) == 3:
		if tf:
			f44(h1,w1,2,3)
		else:
			f44(h1,w1,3,2)
	elif tf:
		f1(h1,h2,w1,w2,2)
		f2(h1,h2,w1,w2,3)
		tf = False
	else:
		f1(h1,h2,w1,w2,3)
		f2(h1,h2,w1,w2,2)
		tf = True
	h1 += 2
	h2 -= 2
	w1 += 2
	w2 -= 2

if (h2-h1) == 1:
	if tf:
		ans.append([h1,w2,1,h1,w2-1,2])
		ans.append([h1+1,w2,1,h1+1,w2-1,2])
	else:
		ans.append([h1,w2,1,h1,w2-1,3])
		ans.append([h1+1,w2,1,h1+1,w2-1,3])
if (h1 < h2) and (w1 < w2):
	
	if tf:
		f1(h1,h2,w1,w2,2)
	else:
		f1(h1,h2,w1,w2,3)
print(an)
for i in ans:
	if hw:
		print(i[1],i[0],i[2],i[4],i[3],i[5])
	else:
		print(*i)
	
0