結果
| 問題 |
No.2929 Miracle Branch
|
| コンテスト | |
| ユーザー |
vwxyz
|
| 提出日時 | 2024-10-12 15:04:25 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 669 bytes |
| コンパイル時間 | 260 ms |
| コンパイル使用メモリ | 81,972 KB |
| 実行使用メモリ | 94,844 KB |
| 最終ジャッジ日時 | 2024-10-12 15:04:37 |
| 合計ジャッジ時間 | 11,235 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 WA * 17 |
ソースコード
from collections import defaultdict
X=int(input())
fact=defaultdict(int)
if X==1:
print(2)
print(1,2)
print("b","g")
exit()
for p in range(2,2*10**5):
while X%p==0:
X//=p
fact[p]+=1
if X>1:
fact[X]+=1
s=0
le=0
for p,e in fact.items():
s+=(p+1)*e
le+=e
if s>2*10**5:
print(-1)
exit()
ans_lst=[]
for i in range(le-1):
ans_lst.append((i,i+1))
cur0=0
cur1=le
for p,e in fact.items():
for i in range(e):
for j in range(p):
ans_lst.append((cur0,cur1))
cur1+=1
cur0+=1
assert len(ans_lst)==s-1
print(s)
for i,j in ans_lst:
print(i+1,j+1)
print(*["b"]*le+["g"]*(s-le))
vwxyz