結果
問題 |
No.1510 Simple Integral
|
ユーザー |
![]() |
提出日時 | 2025-06-12 20:47:00 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 618 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 81,780 KB |
実行使用メモリ | 60,288 KB |
最終ジャッジ日時 | 2025-06-12 20:47:39 |
合計ジャッジ時間 | 3,685 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 WA * 31 |
ソースコード
MOD = 998244353 n = int(input()) a = list(map(int, input().split())) result = 0 for i in range(n): ai = a[i] term = 1 for j in range(n): if i == j: continue aj = a[j] denominator = (ai * ai - aj * aj) % MOD if denominator == 0: print(0) exit() inv_denominator = pow(denominator, MOD-2, MOD) term = term * inv_denominator % MOD inv_ai = pow(ai, MOD-2, MOD) term = term * inv_ai % MOD result = (result + term) % MOD # Multiply by (-1)^(n-1) sign = pow(-1, n-1, MOD) result = result * sign % MOD print(result)