結果

問題 No.2550 MORE! JUMP! MORE!
ユーザー cho435cho435
提出日時 2023-11-28 21:54:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 635 bytes
コンパイル時間 4,634 ms
コンパイル使用メモリ 270,576 KB
実行使用メモリ 12,752 KB
最終ジャッジ日時 2023-11-28 21:55:07
合計ジャッジ時間 9,765 ms
ジャッジサーバーID
(参考情報)
judge13 / 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 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 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 2 ms
6,676 KB
testcase_12 AC 2 ms
6,676 KB
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 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 80 ms
8,576 KB
testcase_21 AC 45 ms
7,712 KB
testcase_22 AC 15 ms
6,676 KB
testcase_23 AC 69 ms
8,320 KB
testcase_24 AC 119 ms
12,696 KB
testcase_25 AC 97 ms
8,448 KB
testcase_26 AC 56 ms
7,936 KB
testcase_27 AC 100 ms
12,128 KB
testcase_28 AC 86 ms
11,760 KB
testcase_29 AC 62 ms
8,064 KB
testcase_30 AC 122 ms
12,752 KB
testcase_31 AC 122 ms
12,752 KB
testcase_32 AC 122 ms
12,752 KB
testcase_33 AC 122 ms
12,752 KB
testcase_34 AC 122 ms
12,752 KB
testcase_35 AC 147 ms
12,752 KB
testcase_36 AC 122 ms
12,752 KB
testcase_37 AC 122 ms
12,752 KB
testcase_38 AC 122 ms
12,752 KB
testcase_39 AC 122 ms
12,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using mint = atcoder::modint998244353;

using S = tuple<mint,mint,mint>;
S op(S a,S b){
	auto[x1,y1,z1]=a;
	auto[x2,y2,z2]=b;
	return {x1+x2,y1+y2,z1+z2};
}
S e(){
	return {0,0,0};
}
using segtree = atcoder::segtree<S,op,e>;

int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	rep(i,n) cin>>a.at(i);
	segtree seg(n+1);
	seg.set(0,{1,1,0});
	rep(i,n){
		auto[sm,nm,ans]=seg.prod(0,i+1);
		ans+=sm*a.at(i);
		sm+=nm;
		seg.set(i+1,{sm,nm,ans});
	}
	auto[sm,nm,ans]=seg.get(n);
	cout<<ans.val()<<endl;
}
0