結果
問題 |
No.2929 Miracle Branch
|
ユーザー |
![]() |
提出日時 | 2024-10-12 16:28:10 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 880 bytes |
コンパイル時間 | 290 ms |
コンパイル使用メモリ | 82,240 KB |
実行使用メモリ | 92,928 KB |
最終ジャッジ日時 | 2024-10-12 16:28:16 |
合計ジャッジ時間 | 4,435 ms |
ジャッジサーバーID (参考情報) |
judge / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | TLE * 1 -- * 42 |
ソースコード
def factorization(n): arr = [] temp = n i=2 while i*i<=n: if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) i+=1 if temp!=1: arr.append([temp, 1]) return arr edge=[] color=["b"] big = 0 X=int(input()) fac=factorization(X) if len(fac)==0: fac.append((1,1)) left=0 for a,b in fac: for _ in range(b): big+=1 if big!=1: edge.append((left,big)) color.append("b") if big>2*10**5: print(-1) exit(0) left=big for i in range(a): big+=1 edge.append((left,big)) color.append("g") if big>2*10**5: print(-1) exit(0) print(big) for u,v in edge: print(u, v) print(*color)