結果

問題 No.2550 MORE! JUMP! MORE!
ユーザー tonphytonphy
提出日時 2023-11-25 14:15:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 681 bytes
コンパイル時間 702 ms
コンパイル使用メモリ 65,596 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-11-25 14:16:03
合計ジャッジ時間 3,585 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 1 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 AC 2 ms
6,676 KB
testcase_17 AC 2 ms
6,676 KB
testcase_18 AC 2 ms
6,676 KB
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 54 ms
6,676 KB
testcase_21 AC 31 ms
6,676 KB
testcase_22 AC 11 ms
6,676 KB
testcase_23 AC 48 ms
6,676 KB
testcase_24 AC 80 ms
6,676 KB
testcase_25 AC 50 ms
6,676 KB
testcase_26 AC 37 ms
6,676 KB
testcase_27 AC 68 ms
6,676 KB
testcase_28 AC 58 ms
6,676 KB
testcase_29 AC 42 ms
6,676 KB
testcase_30 AC 83 ms
6,676 KB
testcase_31 AC 83 ms
6,676 KB
testcase_32 AC 82 ms
6,676 KB
testcase_33 AC 82 ms
6,676 KB
testcase_34 AC 82 ms
6,676 KB
testcase_35 AC 82 ms
6,676 KB
testcase_36 AC 83 ms
6,676 KB
testcase_37 AC 83 ms
6,676 KB
testcase_38 AC 82 ms
6,676 KB
testcase_39 AC 83 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
typedef long long ll;

const ll MOD=998244353;

ll power(ll x,ll n);

int main(){
  ll n;
  ll array[200005];
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>array[i];
  }

  if(n==1){
    cout<<array[1]<<endl;
    return(0);
  }
  
  ll add=power(2,n-3);
  ll cnt[200005];
  cnt[1]=power(2,n-2);
  for(int i=2;i<n;i++){
    cnt[i]=(cnt[i-1]+add)%MOD;
  }
  cnt[n]=((cnt[n-1]+add)*2)%MOD;

  ll ans=0;
  for(int i=1;i<=n;i++){
    ans=(ans+array[i]*cnt[i])%MOD;
  }
  cout<<ans<<endl;
}

ll power(ll x,ll n){
  if(n<=0){
    return(1);
  }

  ll root=power(x,n/2);
  root=(root*root)%MOD;
  if(n&1){
    root=(root*x)%MOD;
  }
  return(root);
}
0