結果
| 問題 | No.2717 Sum of Subarray of Subsequence |
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-04-06 09:09:35 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 575 bytes |
| 記録 | |
| コンパイル時間 | 1,595 ms |
| コンパイル使用メモリ | 198,244 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-14 19:53:09 |
| 合計ジャッジ時間 | 3,392 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 22 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/modint>
using namespace std;
using mint=atcoder::modint998244353;
int N;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N;
if(N==1)
{
int A;
cin>>A;
cout<<A<<endl;
return 0;
}
if(N==2)
{
int A,B;
cin>>A>>B;
cout<<(mint(3)*(A+B)).val()<<endl;
return 0;
}
mint ans=0;
for(int i=N;i--;)
{
int A;
cin>>A;
ans+=mint(A)*(i+2)*(N-i+1)*mint(2).pow(N-3);
}
cout<<ans.val()<<endl;
}
nonon