結果
問題 | No.2966 Simple Plus Minus Problem |
ユーザー | KumaTachiRen |
提出日時 | 2024-11-16 16:29:05 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 4,881 bytes |
コンパイル時間 | 6,392 ms |
コンパイル使用メモリ | 320,656 KB |
実行使用メモリ | 818,012 KB |
最終ジャッジ日時 | 2024-11-16 16:30:07 |
合計ジャッジ時間 | 42,300 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 22 ms
14,976 KB |
testcase_01 | AC | 22 ms
14,848 KB |
testcase_02 | MLE | - |
testcase_03 | AC | 132 ms
22,248 KB |
testcase_04 | AC | 183 ms
28,016 KB |
testcase_05 | AC | 21 ms
14,976 KB |
testcase_06 | AC | 22 ms
14,976 KB |
testcase_07 | AC | 23 ms
15,232 KB |
testcase_08 | AC | 22 ms
15,104 KB |
testcase_09 | AC | 23 ms
15,232 KB |
testcase_10 | AC | 21 ms
14,976 KB |
testcase_11 | AC | 23 ms
15,232 KB |
testcase_12 | AC | 21 ms
14,976 KB |
testcase_13 | AC | 23 ms
15,232 KB |
testcase_14 | AC | 22 ms
15,104 KB |
testcase_15 | AC | 21 ms
14,976 KB |
testcase_16 | AC | 21 ms
15,104 KB |
testcase_17 | AC | 24 ms
15,232 KB |
testcase_18 | AC | 22 ms
14,976 KB |
testcase_19 | AC | 22 ms
15,104 KB |
testcase_20 | AC | 23 ms
15,232 KB |
testcase_21 | AC | 22 ms
14,976 KB |
testcase_22 | AC | 21 ms
15,104 KB |
testcase_23 | AC | 22 ms
15,104 KB |
testcase_24 | AC | 26 ms
15,488 KB |
testcase_25 | AC | 25 ms
15,488 KB |
testcase_26 | AC | 23 ms
15,104 KB |
testcase_27 | AC | 26 ms
15,488 KB |
testcase_28 | AC | 24 ms
15,104 KB |
testcase_29 | AC | 30 ms
15,360 KB |
testcase_30 | AC | 22 ms
14,976 KB |
testcase_31 | AC | 24 ms
15,232 KB |
testcase_32 | AC | 933 ms
440,728 KB |
testcase_33 | MLE | - |
testcase_34 | MLE | - |
testcase_35 | AC | 1,167 ms
442,108 KB |
testcase_36 | AC | 217 ms
58,948 KB |
testcase_37 | MLE | - |
testcase_38 | AC | 597 ms
223,048 KB |
testcase_39 | MLE | - |
testcase_40 | AC | 423 ms
222,996 KB |
testcase_41 | MLE | - |
testcase_42 | MLE | - |
testcase_43 | AC | 956 ms
442,164 KB |
testcase_44 | AC | 815 ms
442,184 KB |
testcase_45 | AC | 186 ms
41,376 KB |
testcase_46 | AC | 875 ms
442,264 KB |
testcase_47 | AC | 263 ms
113,856 KB |
testcase_48 | AC | 303 ms
114,072 KB |
testcase_49 | AC | 426 ms
223,268 KB |
testcase_50 | AC | 798 ms
441,652 KB |
testcase_51 | AC | 819 ms
441,832 KB |
testcase_52 | AC | 91 ms
21,472 KB |
testcase_53 | MLE | - |
testcase_54 | MLE | - |
testcase_55 | MLE | - |
testcase_56 | MLE | - |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using mint = modint998244353; using vm = vector<mint>; using vvm = vector<vm>; inline ostream &operator<<(ostream &os, const mint x) { return os << x.val(); }; inline istream &operator>>(istream &is, mint &x) { long long v; is >> v; x = v; return is; }; struct Fast { Fast() { std::cin.tie(nullptr); ios::sync_with_stdio(false); cout << setprecision(10); } } fast; #define all(a) (a).begin(), (a).end() #define contains(a, x) ((a).find(x) != (a).end()) #define rep(i, a, b) for (int i = (a); i < (int)(b); i++) #define rrep(i, a, b) for (int i = (int)(b) - 1; i >= (a); i--) #define YN(b) cout << ((b) ? "YES" : "NO") << "\n"; #define Yn(b) cout << ((b) ? "Yes" : "No") << "\n"; #define yn(b) cout << ((b) ? "yes" : "no") << "\n"; template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } using ll = long long; using vb = vector<bool>; using vvb = vector<vb>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> &p) { os << "(" << p.first << "," << p.second << ")"; return os; } template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) { for (int i = 0; i < (int)vec.size(); i++) { os << vec[i] << (i + 1 == (int)vec.size() ? "" : " "); } return os; } template <typename T> istream &operator>>(istream &is, vector<T> &vec) { for (int i = 0; i < (int)vec.size(); i++) is >> vec[i]; return is; } ll floor(ll a, ll b) { return a >= 0 ? a / b : (a + 1) / b - 1; } ll ceil(ll a, ll b) { return a > 0 ? (a - 1) / b + 1 : a / b; } template <typename mint> struct factorial { vector<mint> f, g, h; factorial(int MAX = 0) { f.resize(1, mint{1}); g.resize(1, mint{1}); h.resize(1, mint{1}); if (MAX > 0) extend(MAX + 1); } void extend(int m = -1) { int n = f.size(); if (m == -1) m = n * 2; if (n >= m) return; f.resize(m); g.resize(m); h.resize(m); for (int i = n; i < m; i++) f[i] = f[i - 1] * mint(i); g[m - 1] = f[m - 1].inv(); h[m - 1] = g[m - 1] * f[m - 2]; for (int i = m - 2; i >= n; i--) { g[i] = g[i + 1] * mint(i + 1); h[i] = g[i] * f[i - 1]; } } mint fact(int i) { if (i < 0) return mint(0); while (i >= (int)f.size()) extend(); return f[i]; } mint fact_inv(int i) { if (i < 0) return mint(0); while (i >= (int)g.size()) extend(); return g[i]; } mint inv(int i) { if (i < 0) return -inv(-i); while (i >= (int)h.size()) extend(); return h[i]; } mint binom(int n, int r) { if (n < 0 || n < r || r < 0) return mint(0); return fact(n) * fact_inv(n - r) * fact_inv(r); } mint multinom(const vector<int> &r) { int n = 0; for (auto &x : r) { if (x < 0) return mint(0); n += x; } mint res = fact(n); for (auto &x : r) res *= fact_inv(x); return res; } mint binom_naive(int n, int r) { if (n < 0 || n < r || r < 0) return mint(0); mint ret = mint(1); r = min(r, n - r); for (int i = 1; i <= r; ++i) ret *= inv(i) * (n--); return ret; } mint P(int n, int r) { if (n < 0 || n < r || r < 0) return mint(0); return fact(n) * fact_inv(n - r); } mint H(int n, int r) { if (n < 0 || r < 0) return mint(0); return r == 0 ? 1 : binom(n + r - 1, r); } }; void solve() { int n, k; cin >> n >> k; vm a(n); cin >> a; factorial<mint> fact(1000000); if (k & 1) rep(i, 0, n) if (i & 1) a[i] = -a[i]; vm g(n); { int m = (k + 1) / 2; if (m) { rep(i, 0, n) g[i] = fact.binom(m - 1 + i, i); a = convolution(a, g); } } { int m = k / 2; if (m) { rep(i, 0, n) g[i] = fact.binom(m - 1 + i, i) * (i & 1 ? -1 : 1); a = convolution(a, g); } } rep(i, 0, n) cout << a[i] << " \n"[i + 1 == n]; } int main() { int t = 1; // cin >> t; while (t--) solve(); }