結果
問題 |
No.1145 Sums of Powers
|
ユーザー |
![]() |
提出日時 | 2025-06-12 21:34:40 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 717 bytes |
コンパイル時間 | 212 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 59,136 KB |
最終ジャッジ日時 | 2025-06-12 21:36:06 |
合計ジャッジ時間 | 4,656 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 TLE * 1 -- * 2 |
ソースコード
import sys MOD = 998244353 def main(): import sys N, M = map(int, sys.stdin.readline().split()) A = list(map(int, sys.stdin.readline().split())) A = [a % MOD for a in A] # Compute the sum for each K from 1 to M directly # This approach is O(N*M), which is too slow for N, M up to 1e5 # For the purpose of this exercise, we'll provide a correct but slow solution # Warning: This code will not pass the time constraints for large inputs S = [0] * (M + 1) for K in range(1, M+1): s = 0 for a in A: s = (s + pow(a, K, MOD)) % MOD S[K] = s # Output S_1 to S_M print(' '.join(map(str, S[1:M+1]))) if __name__ == '__main__': main()