結果
問題 | No.2625 Bouns Ai |
ユーザー | miscalc |
提出日時 | 2024-02-10 01:27:12 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 3,871 bytes |
コンパイル時間 | 4,084 ms |
コンパイル使用メモリ | 266,060 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-28 16:51:29 |
合計ジャッジ時間 | 4,851 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,820 KB |
testcase_01 | AC | 4 ms
6,816 KB |
testcase_02 | AC | 3 ms
6,816 KB |
testcase_03 | AC | 2 ms
6,820 KB |
testcase_04 | AC | 4 ms
6,820 KB |
testcase_05 | AC | 2 ms
6,820 KB |
testcase_06 | AC | 2 ms
6,816 KB |
testcase_07 | AC | 2 ms
6,820 KB |
testcase_08 | AC | 2 ms
6,816 KB |
testcase_09 | AC | 2 ms
6,816 KB |
testcase_10 | AC | 4 ms
6,820 KB |
testcase_11 | AC | 2 ms
6,820 KB |
testcase_12 | AC | 4 ms
6,816 KB |
testcase_13 | AC | 2 ms
6,816 KB |
testcase_14 | AC | 3 ms
6,820 KB |
testcase_15 | AC | 4 ms
6,816 KB |
testcase_16 | AC | 4 ms
6,816 KB |
testcase_17 | AC | 3 ms
6,820 KB |
testcase_18 | AC | 3 ms
6,820 KB |
testcase_19 | AC | 3 ms
6,816 KB |
testcase_20 | AC | 3 ms
6,816 KB |
testcase_21 | AC | 4 ms
6,820 KB |
testcase_22 | AC | 3 ms
6,816 KB |
testcase_23 | AC | 3 ms
6,816 KB |
testcase_24 | AC | 3 ms
6,820 KB |
testcase_25 | AC | 3 ms
6,816 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; using pll = pair<ll, ll>; using tlll = tuple<ll, ll, ll>; constexpr ll INF = 1LL << 60; template<class T> bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;} template<class T> bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;} ll safemod(ll A, ll M) {ll res = A % M; if (res < 0) res += M; return res;} ll divfloor(ll A, ll B) {if (B < 0) A = -A, B = -B; return (A - safemod(A, B)) / B;} ll divceil(ll A, ll B) {if (B < 0) A = -A, B = -B; return divfloor(A + B - 1, B);} ll pow_ll(ll A, ll B) {if (A == 0 || A == 1) {return A;} if (A == -1) {return B & 1 ? -1 : 1;} ll res = 1; for (int i = 0; i < B; i++) {res *= A;} return res;} ll mul_limited(ll A, ll B, ll M = INF) { return B == 0 ? 0 : A > M / B ? M : A * B; } ll pow_limited(ll A, ll B, ll M = INF) { if (A == 0 || A == 1) {return A;} ll res = 1; for (int i = 0; i < B; i++) {if (res > M / A) return M; res *= A;} return res;} template<class T> void unique(vector<T> &V) {V.erase(unique(V.begin(), V.end()), V.end());} template<class T> void sortunique(vector<T> &V) {sort(V.begin(), V.end()); V.erase(unique(V.begin(), V.end()), V.end());} #define FINALANS(A) do {cout << (A) << '\n'; exit(0);} while (false) //* #include <atcoder/all> using namespace atcoder; using mint = modint998244353; //using mint = modint1000000007; //using mint = modint; template <class T, internal::is_static_modint_t<T> * = nullptr> istream &operator>>(istream &is, T &a) { ll v; is >> v; a = v; return is; } template <class T, internal::is_dynamic_modint_t<T> * = nullptr> istream &operator>>(istream &is, T &a) { ll v; is >> v; a = v; return is; } template <class T, internal::is_static_modint_t<T> * = nullptr> ostream &operator<<(ostream &os, const T &a) { os << a.val(); return os; } template <class T, internal::is_dynamic_modint_t<T> * = nullptr> ostream &operator<<(ostream &os, const T &a) { os << a.val(); return os; } //*/ template<class T> void printvec(const vector<T> &V) {int _n = V.size(); for (int i = 0; i < _n; i++) cout << V[i] << (i == _n - 1 ? "" : " "); cout << '\n';} template<class T> void printvect(const vector<T> &V) {for (auto v : V) cout << v << '\n';} template<class T> void printvec2(const vector<vector<T>> &V) {for (auto &v : V) printvec(v);} template <class T> struct Binomial { private: static vector<T> _fac, _finv, _inv; static void calc(int n) { int i = _fac.size(); if (n < i) return; _fac.resize(n + 1), _finv.resize(n + 1), _inv.resize(n + 1); for (; i <= n; i++) { _fac[i] = _fac[i - 1] * i; _inv[i] = -_inv[T::mod() % i] * (T::mod() / i); _finv[i] = _finv[i - 1] * _inv[i]; } } public: static T fac(int n) { assert(n >= 0); calc(n); return _fac[n]; } static T finv(int n) { if (n < 0) return 0; calc(n); return _finv[n]; } static T inv(int n) { assert(n > 0); calc(n); return _inv[n]; } static T P(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; calc(n); return _fac[n] * _finv[n - k]; } static T C(int n, int k) { if (n < k) return 0; if (n < 0 || k < 0) return 0; calc(n); return _fac[n] * _finv[k] * _finv[n - k]; } static T H(int n, int k) { if (n == 0 && k == 0) return 1; return C(n + k - 1, k); } }; template <class T> vector<T> Binomial<T>::_fac{1, 1}; template <class T> vector<T> Binomial<T>::_finv{1, 1}; template <class T> vector<T> Binomial<T>::_inv{0, 1}; using bi = Binomial<mint>; int main() { ll N; cin >> N; vector<ll> A(N); for (ll i = 0; i < N; i++) { cin >> A.at(i); } ll k = 100000 - A.at(0); for (ll i = 0; i < N - 1; i++) { ll d = max(0LL, A.at(i + 1) - A.at(i)); k -= d; } mint ans = bi::H(N + 1, k); cout << ans << endl; }