結果

問題 No.1529 Constant Lcm
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-06-04 21:02:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,170 bytes
コンパイル時間 189 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 211,744 KB
最終ジャッジ日時 2024-04-30 00:54:39
合計ジャッジ時間 33,794 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 262 ms
88,320 KB
testcase_01 AC 337 ms
89,472 KB
testcase_02 AC 238 ms
88,320 KB
testcase_03 AC 237 ms
88,320 KB
testcase_04 WA -
testcase_05 AC 235 ms
88,576 KB
testcase_06 WA -
testcase_07 AC 263 ms
88,576 KB
testcase_08 WA -
testcase_09 AC 246 ms
88,576 KB
testcase_10 AC 2,489 ms
201,468 KB
testcase_11 AC 1,065 ms
131,388 KB
testcase_12 AC 377 ms
90,368 KB
testcase_13 WA -
testcase_14 AC 1,352 ms
149,024 KB
testcase_15 AC 1,414 ms
153,340 KB
testcase_16 AC 1,159 ms
137,420 KB
testcase_17 AC 736 ms
114,976 KB
testcase_18 AC 804 ms
116,904 KB
testcase_19 AC 1,501 ms
150,400 KB
testcase_20 AC 2,777 ms
211,496 KB
testcase_21 AC 2,577 ms
211,116 KB
testcase_22 AC 2,649 ms
211,244 KB
testcase_23 AC 2,547 ms
211,744 KB
testcase_24 AC 2,492 ms
211,240 KB
testcase_25 AC 2,512 ms
211,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    from collections import Counter
    import math

    def prime_numbers(n):
        is_prime = [True] * (n + 1)
        is_prime[0] = False
        is_prime[1] = False
        for i in range(2, n + 1):
            for j in range(i * 2, n + 1, i):
                is_prime[j] = False
        return [i for i in range(n + 1) if is_prime[i]]
    primes = prime_numbers(10 ** 6 + 1)
    def soinnsuu(x):
        s = []
        for i in primes:
            if i > int(math.sqrt(x)):
                break
            elif x % i == 0:
                while x % i == 0:
                    x //= i
                    s.append(i)
        if not x == 1:
            s.append(x)
        return s
    n = int(input())
    Cs = [soinnsuu(i) for i in range(1, n)]
    d = dict()
    for i in range(1, (n + 1) // 2):
        p1, p2 = Counter(Cs[i - 1]), Counter(Cs[-i])
        for j in p1.keys() | p2.keys():
            if not j in d: d[j] = p1[j] + p2[j]
            else: d[j] = max(d[j], p1[j] + p2[j])
    ans = 1
    mod = 998244353
    for k, v in d.items():
        ans *= pow(k, v, mod)
        ans %= mod
    print(ans)
if __name__ == '__main__':
    main()
0