結果
問題 | No.2048 L(I+D)S |
ユーザー | Mihnea-Vicențiu |
提出日時 | 2025-01-02 05:50:24 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 5,506 bytes |
コンパイル時間 | 4,021 ms |
コンパイル使用メモリ | 313,180 KB |
実行使用メモリ | 11,472 KB |
最終ジャッジ日時 | 2025-01-02 05:50:51 |
合計ジャッジ時間 | 5,016 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 13 ms
11,344 KB |
testcase_01 | AC | 13 ms
11,336 KB |
testcase_02 | AC | 12 ms
11,340 KB |
testcase_03 | AC | 11 ms
11,332 KB |
testcase_04 | AC | 12 ms
11,340 KB |
testcase_05 | AC | 11 ms
11,340 KB |
testcase_06 | AC | 12 ms
11,344 KB |
testcase_07 | AC | 11 ms
11,336 KB |
testcase_08 | AC | 25 ms
11,212 KB |
testcase_09 | AC | 16 ms
11,464 KB |
testcase_10 | AC | 15 ms
11,336 KB |
testcase_11 | WA | - |
testcase_12 | AC | 19 ms
11,340 KB |
testcase_13 | AC | 16 ms
11,336 KB |
testcase_14 | AC | 16 ms
11,340 KB |
testcase_15 | AC | 14 ms
11,340 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
ソースコード
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define ar array #define vt vector #define pq priority_queue #define pu push #define pub push_back #define em emplace #define emb emplace_back #define mt make_tuple #define all(x) x.begin(), x.end() #define allr(x) x.rbegin(), x.rend() #define allp(x, l, r) x.begin() + l, x.begin() + r #define len(x) (int)x.size() #define uniq(x) unique(all(x)), x.end() using ll = long long; using ld = long double; using ull = unsigned long long; template <class T, size_t N> void re(array <T, N>& x); template <class T> void re(vt <T>& x); template <class T> void re(T& x) { cin >> x; } template <class T, class... M> void re(T& x, M&... args) { re(x), re(args...); } template <class T> void re(vt <T>& x) { for(auto& it : x) re(it); } template <class T, size_t N> void re(array <T, N>& x) { for(auto& it : x) re(it); } template <class T, size_t N> void wr(const array <T, N>& x); template <class T> void wr(const vt <T>& x); template <class T> void wr(const T& x) { cout << x; } template <class T, class ...M> void wr(const T& x, const M&... args) { wr(x), wr(args...); } template <class T> void wr(const vt <T>& x) { for(auto it : x) wr(it, ' '); } template <class T, size_t N> void wr(const array <T, N>& x) { for(auto it : x) wr(it, ' '); } template<class T, class... M> auto mvt(size_t n, M&&... args) { if constexpr(sizeof...(args) == 1) return vector<T>(n, args...); else return vector(n, mvt<T>(args...)); } void set_fixed(int p = 0) { cout << fixed << setprecision(p); } void set_scientific() { cout << scientific; } void Open(const string& name) { #ifndef ONLINE_JUDGE (void)!freopen((name + ".in").c_str(), "r", stdin); (void)!freopen((name + ".out").c_str(), "w", stdout); #endif } const int mod = 998'244'353; template <unsigned MOD> struct modint { using M = modint; unsigned x; modint(ll x = 0) { fix(x % MOD + MOD); } inline M& fix(unsigned _x) { x = (_x < MOD)? _x : _x - MOD; return *this; } explicit operator bool() const { return x != 0; } explicit operator long long() const { return x; } inline bool operator == (const M& other) const { return x == other.x; } inline bool operator != (const M& other) const { return x != other.x; } inline bool operator < (const M& other) const { return x < other.x; } inline bool operator > (const M& other) const { return x > other.x; } inline bool operator <= (const M& other) const { return x <= other.x; } inline bool operator >= (const M& other) const { return x >= other.x; } inline M operator + () const { return M().fix(x); } inline M operator - () const { return M().fix(MOD - x); } inline M& operator ++ () { this-> fix(x + 1); return *this; } inline M operator ++ (int) { M tmp(*this); ++(*this); return tmp; } inline M& operator -- () { this-> fix(x - 1 + MOD); return *this; } inline M operator -- (int) { M tmp(*this); --(*this); return tmp; } inline M operator + (const M& other) const { return M().fix(x + other.x); } inline M operator - (const M& other) const { return M().fix(x + MOD - other.x); } inline M operator * (const M& other) const { return M().fix((ull)x * other.x % MOD); } inline M operator / (const M& other) const { return *this * other.inv(); } inline M& operator += (const M& other) { return *this = *this + other; } inline M& operator -= (const M& other) { return *this = *this - other; } inline M& operator *= (const M& other) { return *this = *this * other; } inline M& operator /= (const M& other) { return *this = *this / other; } M lgput(ll b) const { M a = *this, res = 1; while (b) { if (b & 1) res *= a; a *= a; b >>= 1; } return res; } M inv() const { return lgput(MOD - 2); } friend M operator + (const ll& value, const M& n) { return n + M(value); } friend M operator + (const int& value, const M& n) { return n + M(value); } friend M operator - (const ll& value, const M& n) { return n - M(value); } friend M operator - (const int& value, const M& n) { return n - M(value); } friend M operator * (const ll& value, const M& n) { return n * M(value); } friend M operator * (const int& value, const M& n) { return n * M(value); } friend istream& operator >> (istream& in, M& n) { ll x; in >> x; n = x; return in; } friend ostream& operator << (ostream& os, const M& n) { return os << n.x; } }; using mint = modint<mod>; const int N = 1e6 + 1; mint fact[N], ifact[N]; void prec() { fact[0] = ifact[0] = 1; fact[1] = ifact[1] = 1; for (int i = 2; i < N; ++i) fact[i] = fact[i - 1] * i; ifact[N - 1] = fact[N - 1].inv(); for (int i = N - 2; i >= 2; --i) ifact[i] = ifact[i + 1] * (i + 1); } void solve() { int n; re(n); mint res = 0; for (int a = 2; a <= n; ++a) { int b = n - a; mint f_lambda = fact[a + b] / (a * b * fact[a - 2] * fact[b - 2] * (a + b - 1)); res += f_lambda * f_lambda; } wr(res, '\n'); } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); //Open(""); prec(); int t = 1; for(;t;t--) { solve(); } return 0; }