結果

問題 No.1856 Mex Sum 2
ユーザー ytqm3ytqm3
提出日時 2022-02-25 23:05:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 997 bytes
コンパイル時間 4,305 ms
コンパイル使用メモリ 267,424 KB
実行使用メモリ 27,100 KB
最終ジャッジ日時 2023-09-16 18:27:30
合計ジャッジ時間 23,216 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
26,456 KB
testcase_01 AC 38 ms
26,504 KB
testcase_02 AC 39 ms
26,328 KB
testcase_03 AC 38 ms
26,428 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 37 ms
26,392 KB
testcase_08 AC 37 ms
26,392 KB
testcase_09 AC 39 ms
26,452 KB
testcase_10 AC 39 ms
26,468 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 38 ms
26,556 KB
testcase_14 AC 38 ms
26,324 KB
testcase_15 WA -
testcase_16 AC 38 ms
26,416 KB
testcase_17 AC 40 ms
26,292 KB
testcase_18 AC 38 ms
26,452 KB
testcase_19 AC 37 ms
26,408 KB
testcase_20 AC 39 ms
26,520 KB
testcase_21 AC 39 ms
26,516 KB
testcase_22 AC 37 ms
26,512 KB
testcase_23 AC 38 ms
26,292 KB
testcase_24 AC 39 ms
26,444 KB
testcase_25 AC 39 ms
26,380 KB
testcase_26 AC 37 ms
26,340 KB
testcase_27 AC 38 ms
26,548 KB
testcase_28 AC 38 ms
26,440 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 398 ms
27,088 KB
testcase_43 AC 359 ms
26,672 KB
testcase_44 AC 375 ms
26,720 KB
testcase_45 AC 393 ms
26,800 KB
testcase_46 AC 357 ms
26,444 KB
testcase_47 AC 371 ms
26,804 KB
testcase_48 AC 396 ms
26,824 KB
testcase_49 AC 389 ms
26,872 KB
testcase_50 AC 320 ms
26,656 KB
testcase_51 AC 404 ms
26,268 KB
testcase_52 AC 400 ms
26,800 KB
testcase_53 AC 403 ms
26,812 KB
testcase_54 AC 404 ms
26,876 KB
testcase_55 AC 403 ms
26,824 KB
testcase_56 AC 404 ms
27,028 KB
testcase_57 AC 403 ms
26,816 KB
testcase_58 AC 413 ms
26,884 KB
testcase_59 AC 407 ms
26,732 KB
testcase_60 AC 413 ms
26,796 KB
testcase_61 AC 412 ms
27,064 KB
testcase_62 AC 415 ms
26,664 KB
testcase_63 AC 412 ms
26,872 KB
testcase_64 AC 405 ms
26,872 KB
testcase_65 AC 407 ms
26,828 KB
testcase_66 AC 402 ms
26,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
typedef uint64_t u64;
typedef int64_t i64;
template<u64 mod> using modint=atcoder::static_modint<mod>;
using namespace std;

template<typename T> struct comb{
  vector<T> dat,idat;
  comb(int mx=3000000):dat(mx+1,1),idat(mx+1,1){
    for(int i=1;i<=mx;++i){
      dat[i]=dat[i-1]*i;
    }
    idat[mx]/=dat[mx];
    for(int i=mx;i>0;--i){
      idat[i-1]=idat[i]*i;
    }
  }
  T operator()(int n,int k){
    if(n<0||k<0||n<k){
      return 0;
    }
    return dat[n]*idat[k]*idat[n-k];
  }
};

int main(){
  constexpr u64 mod=998244353;
  typedef modint<mod> mint;
  comb<mint> C;
  int N,M;
  cin>>N>>M;
  vector<mint> f(N+1);
  for(int i=0;i<=N;++i){
    f[i]=(mint(2).pow(i)-1)*C.idat[i];
  }
  vector<mint> g(N+1);
  g[0]=1;
  mint ans=0;
  for(int i=0;i<N;++i){
  	g=atcoder::convolution(f,g);
  	g.resize(N+1);
  	mint now=1;
  	for(int j=N;j>i;--j){
  		ans+=C.dat[N]*C.idat[N-j]*now*g[j];
  		now*=2*(M-i);
  	}
  }
  cout<<ans.val()<<endl;
}
0