結果
| 問題 | No.3505 Sum of Prod of Root |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-18 18:43:14 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 879 bytes |
| 記録 | |
| コンパイル時間 | 624 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 28,416 KB |
| 最終ジャッジ日時 | 2026-04-18 18:43:56 |
| 合計ジャッジ時間 | 12,509 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | TLE * 1 -- * 12 |
ソースコード
def compute_product(i):
"""Compute product of floor(i^(1/k)) for all k >= 1"""
if i == 1:
return 1
product = 1
k = 1
# For i <= 10^18, we need at most ~60 iterations
while k <= 63:
# Binary search for floor(i^(1/k))
low, high = 1, min(i, 10**9)
while low < high:
mid = (low + high + 1) // 2
if mid ** k <= i:
low = mid
else:
high = mid - 1
kth_root = low
if kth_root == 1:
# All further roots are 1
break
product *= kth_root
k += 1
return product
def solve(N):
MOD = 998244353
result = 0
for i in range(1, N + 1):
result = (result + compute_product(i)) % MOD
return result
N = int(input())
print(solve(N))