結果

問題 No.2929 Miracle Branch
ユーザー rlangevin
提出日時 2024-11-01 12:07:00
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 431 ms
コンパイル使用メモリ 82,348 KB
実行使用メモリ 109,064 KB
最終ジャッジ日時 2024-11-01 12:07:13
合計ジャッジ時間 12,412 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 26 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

X = int(input())
if X == 1:
    print(2)
    print(1, 2)
    print("b g")
    exit()

M = 2 * 10 ** 5
L = []
for i in range(2, M + 1):
    while X % i == 0:
        L.append(i)
        X //= i

if X != 1:
    print(-1)
    exit()

now = len(L)
GB = ["b"] * now
ans = []
for i in range(now - 1):
    ans.append((i + 1, i + 2))

now += 1
for i in range(len(L)):
    for j in range(L[i]):
        ans.append((i + 1, now))
        now += 1
        GB.append("g")
        
if len(GB) > M:
    print(-1)
    exit()
    
print(len(GB))
for a, b in ans:
    print(a, b)
print(*GB)
0