結果
問題 | No.2413 Multiple of 99 |
ユーザー |
![]() |
提出日時 | 2023-07-21 13:28:36 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 5,579 bytes |
コンパイル時間 | 685 ms |
コンパイル使用メモリ | 56,192 KB |
最終ジャッジ日時 | 2025-02-15 16:07:37 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp:206:10: fatal error: testlib.h: No such file or directory 206 | #include "testlib.h" | ^~~~~~~~~~~ compilation terminated.
ソースコード
#include <string.h> #include <algorithm> #include <array> #include <bitset> #include <cassert> #include <cfloat> #include <chrono> #include <ciso646> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <fstream> #include <functional> #include <iomanip> #include <iostream> #include <map> #include <numeric> #include <optional> #include <queue> #include <random> #include <set> #include <stack> #include <string> #include <unordered_map> #include <unordered_set> #include <utility> #include <vector> #define REP_OVERLOAD(arg1, arg2, arg3, arg4, NAME, ...) NAME #define REP3(i, l, r, s) \ for (int i = int(l), rep3_r = int(r), rep3_s = int(s); i < rep3_r; \ i += rep3_s) #define REP2(i, l, r) REP3(i, l, r, 1) #define REP1(i, n) REP2(i, 0, n) #define rep(...) REP_OVERLOAD(__VA_ARGS__, REP3, REP2, REP1, )(__VA_ARGS__) #define repin(i, l, r) for (int i = int(l), repin_r = int(r); i <= repin_r; ++i) #define RREP_OVERLOAD(arg1, arg2, arg3, arg4, NAME, ...) NAME #define RREP3(i, l, r, s) \ for (int i = int(r) - 1, rrep3_l = int(l), rrep3_s = int(s); i >= rrep3_l; \ i -= rrep3_s) #define RREP2(i, l, r) RREP3(i, l, r, 1) #define RREP1(i, n) RREP2(i, 0, n) #define rrep(...) RREP_OVERLOAD(__VA_ARGS__, RREP3, RREP2, RREP1, )(__VA_ARGS__) #define rrepin(i, l, r) \ for (int i = int(r), rrepin_l = int(l); i >= rrepin_l; --i) #define all(v) v.begin(), v.end() #include <algorithm> #include <cassert> #include <iostream> #include <vector> namespace rklib { template <class T> std::ostream &operator<<(std::ostream &os, const std::vector<T> &v) { os << "["; for (auto d : v) os << d << ", "; return os << "]"; } // a <- max(a, b) template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } // a <- min(a, b) template <class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; } // if a < 0: a <- b // else: a <- min(a, b) template <class T> bool chmin_non_negative(T &a, const T &b) { if (a < 0 || a > b) { a = b; return true; } return false; } // floor(num / den) template <class T> T div_floor(T num, T den) { if (den < 0) num = -num, den = -den; return num >= 0 ? num / den : (num + 1) / den - 1; } // ceil(num / den) template <class T> T div_ceil(T num, T den) { if (den < 0) num = -num, den = -den; return num <= 0 ? num / den : (num - 1) / den + 1; } } // namespace rklib using namespace std; using namespace rklib; using lint = long long; using ulint = unsigned long long; using pii = pair<int, int>; using pll = pair<lint, lint>; template <class T> using vec = vector<T>; template <class T> using vvec = vec<vec<T>>; template <class T> using vvvec = vec<vvec<T>>; #include <atcoder/convolution> #include <atcoder/modint> #include <atcoder/modint> #include <vector> namespace rklib { template <class T> struct Factorial { public: Factorial() : Factorial(0) {} Factorial(int n) { fc.resize(n + 1); inv_fc.resize(n + 1); fc[0] = 1; for (int i = 0; i < n; ++i) fc[i + 1] = fc[i] * (i + 1); inv_fc[n] = 1 / fc[n]; for (int i = n - 1; i >= 0; --i) inv_fc[i] = inv_fc[i + 1] * (i + 1); } T fact(int n) { if (n >= (int)fc.size()) extend(n); return fc[n]; } T inv_fact(int n) { if (n >= (int)fc.size()) extend(n); return inv_fc[n]; } T inv(int n) { assert(n > 0); if (n >= (int)fc.size()) extend(n); return inv_fc[n] * fc[n - 1]; } T comb(int n, int r) { if (n < r || r < 0) return 0; if (n >= (int)fc.size()) extend(n); return fc[n] * inv_fc[r] * inv_fc[n - r]; } T perm(int n, int r) { if (n < r || r < 0) return 0; if (n >= (int)fc.size()) extend(n); return fc[n] * inv_fc[n - r]; } private: std::vector<T> fc; std::vector<T> inv_fc; void extend(int n) { int l = fc.size(); int r = l; while (r <= n) r *= 2; fc.resize(r); inv_fc.resize(r); for (int i = l; i < r; ++i) fc[i] = fc[i - 1] * i; inv_fc[r - 1] = 1 / fc[r - 1]; for (int i = r - 2; i >= l; --i) inv_fc[i] = inv_fc[i + 1] * (i + 1); } }; } // namespace rklib using mint = atcoder::modint998244353; Factorial<mint> fc; #include "testlib.h" vec<mint> get_h(int m) { vec<mint> f(10 * m + 1, 0); rep(i, m + 1) { auto tmp = fc.comb(m, i); if (i % 2 == 1) tmp = -tmp; f[i * 10] = tmp; } vec<mint> g(9 * m + 1, 0); rep(i, g.size()) { g[i] = fc.comb(i + m - 1, i); } auto res = atcoder::convolution(f, g); res.resize(9 * m + 1); return res; } int main(int argc, char* argv[]) { registerValidation(argc, argv); int n = inf.readInt(2, 100'000); inf.readSpace(); int k = inf.readInt(1, 100'000); inf.readEoln(); inf.readEof(); auto h0 = get_h((n + 1) / 2); auto h1 = get_h(n / 2); mint ans = 0; rep(d, 11) { auto f = h0; rep(i, f.size()) if (i % 11 != d) f[i] = 0; auto g = h1; rep(i, g.size()) if (i % 11 != d) g[i] = 0; auto h = atcoder::convolution(f, g); for (int i = 0; i < int(h.size()); i += 9) { ans += mint(i).pow(k) * h[i]; } } cout << ans.val() << endl; }