結果
問題 | No.940 ワープ ε=ε=ε=ε=ε=│;p>д<│ |
ユーザー | 沙耶花 |
提出日時 | 2023-01-25 15:25:27 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 2,372 bytes |
コンパイル時間 | 4,737 ms |
コンパイル使用メモリ | 278,052 KB |
実行使用メモリ | 52,476 KB |
最終ジャッジ日時 | 2024-06-26 19:58:50 |
合計ジャッジ時間 | 10,251 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 21 ms
11,648 KB |
testcase_01 | AC | 21 ms
11,776 KB |
testcase_02 | AC | 21 ms
11,776 KB |
testcase_03 | AC | 25 ms
12,160 KB |
testcase_04 | AC | 21 ms
11,648 KB |
testcase_05 | AC | 23 ms
11,776 KB |
testcase_06 | AC | 22 ms
11,904 KB |
testcase_07 | AC | 23 ms
11,776 KB |
testcase_08 | AC | 21 ms
11,776 KB |
testcase_09 | AC | 21 ms
11,872 KB |
testcase_10 | AC | 23 ms
11,904 KB |
testcase_11 | AC | 22 ms
11,904 KB |
testcase_12 | AC | 23 ms
11,776 KB |
testcase_13 | AC | 22 ms
11,868 KB |
testcase_14 | AC | 21 ms
11,640 KB |
testcase_15 | AC | 97 ms
20,844 KB |
testcase_16 | AC | 186 ms
40,164 KB |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | AC | 335 ms
52,476 KB |
testcase_22 | RE | - |
testcase_23 | AC | 326 ms
45,712 KB |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint1000000007; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 struct combi{ deque<mint> kaijou; deque<mint> kaijou_; combi(int n){ kaijou.push_back(1); for(int i=1;i<=n;i++){ kaijou.push_back(kaijou[i-1]*i); } mint b=kaijou[n].inv(); kaijou_.push_front(b); for(int i=1;i<=n;i++){ int k=n+1-i; kaijou_.push_front(kaijou_[0]*k); } } mint combination(int n,int r){ if(r>n)return 0; mint a = kaijou[n]*kaijou_[r]; a *= kaijou_[n-r]; return a; } mint junretsu(int a,int b){ mint x = kaijou_[a]*kaijou_[b]; x *= kaijou[a+b]; return x; } mint catalan(int n){ return combination(2*n,n)/(n+1); } }; template <class T> vector<T> convolution_mint(vector<T> a,vector<T> b){ static constexpr unsigned long long M0 = 998244353; static constexpr unsigned long long M1 = 754974721; static constexpr unsigned long long M2 = 469762049; vector<long long> aa(a.size()),bb(b.size()); rep(i,a.size())aa[i] = a[i].val(); rep(i,b.size())bb[i] = b[i].val(); auto c0 = convolution<M0>(aa,bb); auto c1 = convolution<M1>(aa,bb); auto c2 = convolution<M2>(aa,bb); vector<mint> ret(c0.size()); rep(i,c0.size()){ ret[i] += c0[i]; { long long cur = c0[i]; cur %= M1; cur = c1[i]-cur; if(cur<0)cur += M1; cur *= 416537774; cur %= M1; mint m = M0; ret[i] += m*cur; cur *= M0; cur += c0[i]; cur %= M2; cur = c2[i] - cur; if(cur<0)cur += M2; cur *= 429847628; cur %= M2; m *= M1; ret[i] += m * cur; } } return ret; } combi C(1000000); int main(){ int X,Y,Z; cin>>X>>Y>>Z; if(X==0&&Y==0&&Z==0){ cout<<1<<endl; return 0; } vector<mint> t(X+Y+Z+1); auto s= t; for(int i=1;i<t.size();i++){ t[i] = 1; t[i] *= C.junretsu(X,i-1); t[i] *= C.junretsu(Y,i-1); t[i] *= C.junretsu(Z,i-1); t[i] *= C.kaijou_[i]; s[i] = C.kaijou_[i]; if(i%2==1)s[i] *= -1; } s[0] = 1; /* rep(i,t.size()){ cout<<t[i].val()<<','<<s[i].val()<<endl; } cout<<endl; */ mint p = 0; auto ans = convolution_mint(t,s); rep(i,X+Y+Z+1){ ans[i] *= C.kaijou[i]; //cout<<ans[i].val()<<endl; p += ans[i]; } cout<<p.val()<<endl; return 0; }