結果
問題 | No.2164 Equal Balls |
ユーザー |
|
提出日時 | 2022-12-16 10:44:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,228 bytes |
コンパイル時間 | 713 ms |
コンパイル使用メモリ | 95,116 KB |
最終ジャッジ日時 | 2024-11-15 15:49:59 |
合計ジャッジ時間 | 2,551 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、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:41:5: error: 'cout' was not declared in this scope 41 | cout << tb[0][300 * M].val() << '\n'; | ^~~~ main.cpp:41: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; i < M; i++){for(int k = i; k < N; k += M){for(int j = -B[k]; j <= A[k]; j++) tb[i][j + 300] *= comb[A[k] + B[k]][B[k] + j];for(int j = A[k] + 1; j <= 300; j++) tb[i][j + 300] = 0;for(int j = B[k] + 1; j <= 300; j++) tb[i][-j + 300] = 0;}}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';}