結果
問題 | No.1396 Giri |
ユーザー | shotoyoo |
提出日時 | 2021-02-14 21:38:00 |
言語 | PyPy3 (7.3.15) |
結果 |
RE
|
実行時間 | - |
コード長 | 950 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 87,036 KB |
実行使用メモリ | 116,412 KB |
最終ジャッジ日時 | 2023-09-29 14:51:54 |
合計ジャッジ時間 | 10,817 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 92 ms
71,816 KB |
testcase_01 | AC | 90 ms
71,904 KB |
testcase_02 | AC | 913 ms
116,284 KB |
testcase_03 | AC | 93 ms
71,740 KB |
testcase_04 | AC | 92 ms
71,540 KB |
testcase_05 | AC | 915 ms
116,412 KB |
testcase_06 | RE | - |
testcase_07 | RE | - |
testcase_08 | AC | 91 ms
71,620 KB |
testcase_09 | RE | - |
testcase_10 | AC | 92 ms
71,564 KB |
testcase_11 | AC | 92 ms
71,556 KB |
testcase_12 | AC | 94 ms
71,752 KB |
testcase_13 | AC | 93 ms
71,624 KB |
testcase_14 | AC | 92 ms
71,624 KB |
testcase_15 | AC | 91 ms
71,696 KB |
testcase_16 | AC | 118 ms
78,016 KB |
testcase_17 | AC | 130 ms
78,580 KB |
testcase_18 | RE | - |
testcase_19 | AC | 501 ms
97,896 KB |
testcase_20 | AC | 673 ms
106,788 KB |
testcase_21 | AC | 829 ms
112,284 KB |
testcase_22 | AC | 904 ms
116,268 KB |
testcase_23 | AC | 918 ms
116,312 KB |
testcase_24 | AC | 902 ms
116,312 KB |
testcase_25 | AC | 913 ms
116,192 KB |
ソースコード
import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") n = int(input()) def hurui(n): pl = [] mpf = [None]*(n+1) for d in range(2,n): if mpf[d] is None: mpf[d] = d pl.append(d) for p in pl: if p*d>n or p>mpf[d]: break mpf[p*d] = p return pl, mpf from collections import defaultdict def factor(num): d = defaultdict(int) if num==1: d.update({1:1}) return d while num>1: d[mpf[num]] += 1 num //= mpf[num] return d ps,mpf = hurui(n) for i in range(n, 1, -1): if mpf[i]==i: break ans = 1 M = 998244353 d = defaultdict(int) for j in range(1, n+1): if i==j: continue f = factor(j) for k,v in f.items(): d[k] = max(d[k], v) for k,v in d.items(): ans *= pow(k,v,M) ans %= M print(ans)