結果
| 問題 |
No.2929 Miracle Branch
|
| コンテスト | |
| ユーザー |
寝癖
|
| 提出日時 | 2024-10-12 17:21:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 700 bytes |
| コンパイル時間 | 498 ms |
| コンパイル使用メモリ | 82,372 KB |
| 実行使用メモリ | 84,124 KB |
| 最終ジャッジ日時 | 2024-10-12 17:21:20 |
| 合計ジャッジ時間 | 9,785 ms |
|
ジャッジサーバーID (参考情報) |
judge / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 29 WA * 14 |
ソースコード
X = int(input())
M = 2*10**5
def prime_factorize(n):
res = []
for i in range(2, M+1):
if i*i > n:
break
if n % i != 0:
continue
while n % i == 0:
n //= i
res.append(i)
if n != 1 or len(res) == 0:
res.append(n)
return res
pf = prime_factorize(X)
cnt2 = sum(1 for x in pf if x == 2)
pf.extend([4]*(cnt2//2))
pf = pf[cnt2:]
if len(pf) + sum(pf) > M:
print(-1)
exit()
print(len(pf) + sum(pf))
c = ['b']*len(pf) + ['g']*sum(pf)
for i in range(len(pf)-1):
print(i+1, i+2)
ind = len(pf)
for i in range(len(pf)):
for j in range(pf[i]):
print(i+1, ind+j+1)
ind += pf[i]
print(*c)
寝癖