結果

問題 No.2929 Miracle Branch
ユーザー hiro1729
提出日時 2024-10-12 15:31:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 490 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,312 KB
実行使用メモリ 81,436 KB
最終ジャッジ日時 2024-10-12 15:32:09
合計ジャッジ時間 9,549 ms
ジャッジサーバーID
(参考情報)
judge3 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

X = int(input())
s = []
if X == 1:
	s += [1]
for i in range(2, 200001):
	if X % i == 0:
		c = 0
		while X % i == 0:
			X //= i
			c += 1
		if i == 2:
			s += [4] * (c // 2) + [2] * (c % 2)
		else:
			s += [i] * c
N = len(s) + sum(s)
if X == 1 and N <= 200000:
	print(N)
	t = len(s)
	for i in range(len(s) - 1):
		print(i + 1, i + 2)
	for i in range(len(s)):
		for j in range(t, t + s[i]):
			print(i + 1, j + 1)
		t += s[i]
	print(' '.join(['b'] * len(s) + ['g'] * sum(s)))
else:
	print(-1)
0