結果
問題 |
No.2929 Miracle Branch
|
ユーザー |
|
提出日時 | 2025-02-07 15:42:22 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 715 bytes |
コンパイル時間 | 411 ms |
コンパイル使用メモリ | 82,292 KB |
実行使用メモリ | 84,564 KB |
最終ジャッジ日時 | 2025-02-07 15:42:34 |
合計ジャッジ時間 | 11,848 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 9 WA * 34 |
ソースコード
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) 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)