結果
| 問題 |
No.2164 Equal Balls
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-15 02:22:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,214 bytes |
| コンパイル時間 | 794 ms |
| コンパイル使用メモリ | 96,680 KB |
| 最終ジャッジ日時 | 2024-11-15 03:06:21 |
| 合計ジャッジ時間 | 1,536 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:7:10: error: incomplete type 'std::ios' {aka 'std::basic_ios<char>'} used in nested name specifier
7 | ios::sync_with_stdio(false);
| ^~~~~~~~~~~~~~~
main.cpp:8:5: error: 'cin' was not declared in this scope
8 | cin.tie(0);
| ^~~
main.cpp:2:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
1 | #include <atcoder/all>
+++ |+#include <iostream>
2 | using namespace std;
main.cpp:40:5: error: 'cout' was not declared in this scope
40 | cout << tb[0][300 * M].val() << '\n';
| ^~~~
main.cpp:40:5: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
ソースコード
#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;
}
int s = 300 * M + 1;
auto merge = [&](int i, int j){
if(j >= M)return;
tb[i] = convolution(tb[i], tb[j]);
if(tb[i].size() > s) tb[i].resize(s);
};
for(int i = 0; i < 9; i++){
int d = 1 << i + 1;
for(int j = 0; j < M; j += d) merge(j, j + (1 << i));
}
cout << tb[0][300 * M].val() << '\n';
}