結果
問題 | No.2111 Sum of Diff |
ユーザー |
|
提出日時 | 2022-10-28 21:28:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 86 ms / 2,000 ms |
コード長 | 356 bytes |
コンパイル時間 | 591 ms |
コンパイル使用メモリ | 67,120 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-06 00:29:20 |
合計ジャッジ時間 | 2,466 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 20 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 7 | main() | ^~~~
ソースコード
#include<iostream>#include<atcoder/modint>using namespace std;using mint=atcoder::modint998244353;int N,A[2<<17];mint p2[2<<17];main(){cin>>N;p2[0]=1;for(int i=1;i<=N;i++)p2[i]=p2[i-1]*2;mint ans=0,prv=0,pc=0;for(int i=0;i<N;i++){cin>>A[i];ans-=(pc*A[i]+prv)*p2[N-i-1];prv-=A[i]*p2[i];pc+=p2[i];}cout<<ans.val()<<endl;}