結果

問題 No.1857 Gacha Addiction
ユーザー 蜜蜂蜜蜂
提出日時 2022-01-03 11:01:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,479 bytes
コンパイル時間 4,065 ms
コンパイル使用メモリ 238,596 KB
実行使用メモリ 9,320 KB
最終ジャッジ日時 2023-09-14 14:44:21
合計ジャッジ時間 13,630 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 116 ms
4,380 KB
testcase_05 AC 117 ms
4,380 KB
testcase_06 AC 115 ms
4,376 KB
testcase_07 AC 117 ms
4,380 KB
testcase_08 AC 115 ms
4,380 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

//g++ 2.cpp -std=c++14 -O2 -I .
#include <bits/stdc++.h>
using namespace std;

#include <atcoder/all>
using namespace atcoder;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vst = vector<string>;
using vvst = vector<vst>;

#define fi first
#define se second
#define pb push_back
#define pq_big(T) priority_queue<T,vector<T>,less<T>>
#define pq_small(T) priority_queue<T,vector<T>,greater<T>>
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)
#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())

constexpr ll mod = 998244353;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  ll s;
  cin>>n>>s;

  ll inv_s=pow_mod(s,mod-2,mod);

  vll p(n);
  rep(i,0,n){
    cin>>p[i];
    p[i]*=inv_s;
    p[i]%=mod;
  }

  vll q={1},r={0};
  rep(i,0,n){
    vll a={1,p[i]};
    vll b={0,(p[i]*p[i])%mod};

    vll x=convolution(q,a);
    vll y=convolution(q,b);
    vll z=convolution(r,a);

    rep(i,0,z.size()){
      if(i<y.size()){
        y[i]+=z[i];
        y[i]%=mod;
      }
      else{
        y.emplace_back(z[i]);
      }
    }

    q=x,r=y;
  }

  ll ans=0;
  ll fractal=2;
  rep(i,1,r.size()){
    ans+=r[i]*fractal;
    ans%=mod;
    fractal*=i+2;
    fractal%=mod;
  }

  cout<<ans<<endl;
}
0