結果
問題 |
No.2929 Miracle Branch
|
ユーザー |
![]() |
提出日時 | 2024-11-19 03:26:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 845 bytes |
コンパイル時間 | 287 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 34,688 KB |
最終ジャッジ日時 | 2024-11-19 03:27:21 |
合計ジャッジ時間 | 69,692 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 24 TLE * 19 |
ソースコード
x=int(input()) # 素因数分解 import math L=int(math.sqrt(x)) FACT=dict() for i in range(2,L+2): while x%i==0: FACT[i]=FACT.get(i,0)+1 x=x//i if x!=1: FACT[x]=FACT.get(x,0)+1 LIST=[] for f in FACT: x=FACT[f] if f==2: while x>=2: LIST.append(4) x-=2 if x==1: LIST.append(2) else: for i in range(x): LIST.append(f) if len(LIST)+sum(LIST)>200000: print(-1) else: X=len(LIST)+sum(LIST) print(X) ANS=[] for i in range(1,len(LIST)): ANS.append((i,i+1)) c=len(LIST)+1 for i in range(1,len(LIST)+1): for j in range(LIST[i-1]): ANS.append((i,c)) c+=1 for x,y in ANS: print(x,y) LL=["b"]*len(LIST)+["g"]*sum(LIST) print(" ".join(LL))