結果
| 問題 |
No.2929 Miracle Branch
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-02-07 15:44:23 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 785 bytes |
| コンパイル時間 | 434 ms |
| コンパイル使用メモリ | 82,252 KB |
| 実行使用メモリ | 84,336 KB |
| 最終ジャッジ日時 | 2025-02-07 15:44:35 |
| 合計ジャッジ時間 | 10,096 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 17 |
ソースコード
from collections import defaultdict
x=int(input())
if x==1:
print(2)
print(1,2)
print("b","g")
exit()
def factorize(n):
b = 2
fct = defaultdict(int)
while b * b <= n and b<=10**5:
while n % b == 0:
n //= b
fct[b] += 1
b = b + 1
if n > 1:
fct[n] += 1
return fct
P=factorize(x)
S=sum(i*j for i,j in P.items())+sum(i for i in P.values())
if S>2*10**5:
print(-1)
exit()
G=[i for i in range(1,1+sum(i for i in P.values()))]
nb=0
ng=G[-1]+1
print(S)
if len(G)>1:
for i in range(len(G)-1):
print(G[i],G[i+1])
for i,j in P.items():
for _ in range(j):
for k in range(i):
print(G[nb],ng)
ng+=1
nb+=1
ans=["b"]*len(G)+["g"]*(S-len(G))
print(*ans)