結果

問題 No.2111 Sum of Diff
ユーザー umezoumezo
提出日時 2022-10-28 22:33:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 503 bytes
コンパイル時間 2,427 ms
コンパイル使用メモリ 200,368 KB
実行使用メモリ 6,296 KB
最終ジャッジ日時 2023-09-20 05:40:08
合計ジャッジ時間 4,283 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,520 KB
testcase_01 AC 4 ms
4,572 KB
testcase_02 AC 29 ms
6,100 KB
testcase_03 AC 21 ms
5,620 KB
testcase_04 AC 8 ms
5,024 KB
testcase_05 AC 29 ms
6,296 KB
testcase_06 AC 29 ms
6,168 KB
testcase_07 AC 10 ms
4,772 KB
testcase_08 AC 12 ms
5,184 KB
testcase_09 AC 5 ms
4,688 KB
testcase_10 AC 6 ms
4,508 KB
testcase_11 AC 16 ms
5,440 KB
testcase_12 AC 15 ms
5,432 KB
testcase_13 AC 11 ms
5,168 KB
testcase_14 AC 25 ms
5,828 KB
testcase_15 AC 28 ms
6,228 KB
testcase_16 AC 14 ms
5,308 KB
testcase_17 AC 29 ms
6,240 KB
testcase_18 AC 12 ms
5,168 KB
testcase_19 AC 22 ms
5,712 KB
testcase_20 AC 30 ms
6,276 KB
testcase_21 AC 4 ms
4,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

const int MOD=998244353;
 
int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n;
  cin>>n;
  vector<ll> A(n);
  rep(i,n) cin>>A[i];
  
  ll ans=0;
  vector<ll> B(200200);
  B[0]=1LL;
  for(int i=1;i<200200;i++) B[i]=B[i-1]*2%MOD;
  rep(i,n){
    ans=(ans+A[i]*(B[n-1-i]-B[i]+MOD)%MOD)%MOD;
  }
  cout<<ans<<endl;
  
  return 0;
}
0