結果

問題 No.1145 Sums of Powers
ユーザー lam6er
提出日時 2025-04-16 00:42:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 554 bytes
コンパイル時間 181 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 61,968 KB
最終ジャッジ日時 2025-04-16 00:46:26
合計ジャッジ時間 3,880 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 3 TLE * 1 -- * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

def main():
    import sys
    input = sys.stdin.read().split()
    idx = 0
    N = int(input[idx])
    idx += 1
    M = int(input[idx])
    idx += 1
    A = list(map(int, input[idx:idx+N]))
    idx += N
    
    S = [0] * (M + 1)
    
    for a in A:
        if a == 0:
            continue
        current = a
        for k in range(1, M + 1):
            S[k] = (S[k] + current) % MOD
            if k < M:
                current = current * a % MOD
    
    print(' '.join(map(str, S[1:M+1])))

if __name__ == '__main__':
    main()
0