結果
| 問題 |
No.2164 Equal Balls
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-15 04:22:25 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,030 bytes |
| コンパイル時間 | 1,841 ms |
| コンパイル使用メモリ | 127,232 KB |
| 最終ジャッジ日時 | 2024-11-15 03:08:20 |
| 合計ジャッジ時間 | 2,570 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:7:5: error: implicit instantiation of undefined template 'std::basic_ios<char>'
7 | ios::sync_with_stdio(false);
| ^
/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/iosfwd:77:11: note: template is declared here
77 | class basic_ios;
| ^
main.cpp:8:5: error: use of undeclared identifier 'cin'; did you mean 'min'?
8 | cin.tie(0);
| ^~~
| min
/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/algorithmfwd.h:420:5: note: 'min' declared here
420 | min(const _Tp&, const _Tp&);
| ^
main.cpp:8:5: error: reference to overloaded function could not be resolved; did you mean to call it?
8 | cin.tie(0);
| ^~~
/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/algorithmfwd.h:420:5: note: possible target for call
420 | min(const _Tp&, const _Tp&);
| ^
main.cpp:10:5: error: use of undeclared identifier 'cin'; did you mean 'min'?
10 | cin >> N >> M;
| ^~~
| min
/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/algorithmfwd.h:420:5: note: 'min' declared here
420 | min(const _Tp&, const _Tp&);
| ^
main.cpp:10:5: error: reference to overloaded function could not be resolved; did you mean to call it?
10 | cin >> N >> M;
| ^~~
/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/algorithmfwd.h:420:5: note: possible target for call
420 | min(const _Tp&, const _Tp&);
| ^
main.cpp:12:20: error: use of undeclared identifier 'cin'; did you mean 'min'?
12 | for(auto &&v:A)cin >> v;
| ^~~
| min
/usr/lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/algorithmfwd.h:420:5: note: 'min' declared here
420 | min(const _Tp&, const _Tp&);
| ^
main.cpp:12:20: error: reference to overloaded function could not be resolved; did you mean to call it?
12 |
ソースコード
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int N, M, r = 600;
cin >> N >> M;
vector<int> A(N), B(N);
for(auto &&v:A)cin >> v;
for(auto &&v:B)cin >> v;
vector<vector<mint>> comb(r + 1), tb(M, vector<mint>(r + 1, 1));
for(int i = 1; i <= r; i++){
comb[i].resize(i + 1);
comb[i][0] = comb[i][i] = 1;
for(int j = 1; j < i; j++) comb[i][j] = comb[i - 1][j - 1] + comb[i - 1][j];
}
for(int i = 0, rem = 0; i < N; i++){
for(int j = -B[i]; j <= A[i]; j++) tb[rem][j + 300] *= comb[A[i] + B[i]][B[i] + j];
for(int j = A[i] + 1; j <= 300; j++) tb[rem][j + 300] = 0;
for(int j = B[i] + 1; j <= 300; j++) tb[rem][-j + 300] = 0;
if(++rem >= M)rem -= M;
}
cout << reduce(tb.begin(), tb.end(), vector<mint>(1, 1), [](vector<mint> lhs, vector<mint> rhs){
return convolution(lhs, rhs);
})[300 * M].val() << '\n';
}