結果

問題 No.1325 Subsequence Score
ユーザー umezoumezo
提出日時 2020-12-22 00:34:33
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 187 ms / 2,000 ms
コード長 577 bytes
コンパイル時間 2,275 ms
コンパイル使用メモリ 203,904 KB
実行使用メモリ 7,220 KB
最終ジャッジ日時 2023-10-21 12:15:35
合計ジャッジ時間 5,374 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 187 ms
7,220 KB
testcase_14 AC 55 ms
4,384 KB
testcase_15 AC 154 ms
6,496 KB
testcase_16 AC 176 ms
6,956 KB
testcase_17 AC 80 ms
4,912 KB
testcase_18 AC 45 ms
4,384 KB
testcase_19 AC 186 ms
7,220 KB
testcase_20 AC 26 ms
4,348 KB
testcase_21 AC 63 ms
4,648 KB
testcase_22 AC 83 ms
4,912 KB
testcase_23 AC 185 ms
7,220 KB
testcase_24 AC 182 ms
7,220 KB
testcase_25 AC 187 ms
7,220 KB
testcase_26 AC 184 ms
7,220 KB
testcase_27 AC 184 ms
7,220 KB
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 2 ms
4,348 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;

ll modpow(ll x,ll n){
  ll ans=1;
  while(n){
    if(n&1) ans=ans*x%MOD;
    x=x*x%MOD;
    n/=2;
  }
  return ans;
}

int main(){
  int n;
  cin>>n;
  
  vector<ll> A(n+1);
  rep(i,n) cin>>A[i+1];
  
  if(n==1){
    cout<<A[1]%MOD<<endl;
    return 0;
  }
  
  ll ans=0;
  for(ll i=1;i<=n;i++){
    ans=(ans+A[i]*(i+1)%MOD)%MOD;
  }
  ans=ans*modpow(2LL,n-2)%MOD;
  cout<<ans<<endl;
  
  return 0;
}
0