提出 #33622708


ソースコード 拡げる

/** @file
 * @ingroup


 */
#include <bits/stdc++.h>
using namespace std;
template <typename T> inline void O(const T &x) { cout << x << '\n'; }
template <typename T, typename... W> inline void O(const T &x, const W &...b) {
  cout << x << ' ';
  O(b...);
}
template <typename T> inline void rd(T &x) { cin >> x; }
template <typename T, typename... W> inline void rd(T &x, W &...b) {
  cin >> x;
  rd(b...);
}
#ifndef MISAKA
#define err(...)
#else
#define err(...) fprintf(stderr, __VA_ARGS__)
#endif
typedef long long i64;
typedef unsigned long long u64;
typedef unsigned u32;
typedef long double dbl;
typedef pair<int, int> pii;
typedef uniform_int_distribution<int> r32;
typedef uniform_int_distribution<i64> r64;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
#define shuf(L, R) shuffle((L), (R), rng)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define FOR(i, j, k) for (int i = (j); i <= (k); ++i)
#define ROF(i, j, k) for (int i = (k); i >= (j); --i)
template <typename T> inline void ckmin(T &a, const T &b) { a = min(a, b); }
template <typename T> inline void ckmax(T &a, const T &b) { a = max(a, b); }
//#define IOFILE "temp"
//#define MULTI
const int N = 1e6;
const int p = 998244353;

int fac[N], ifac[N], inv[N];
inline void sol() {
  inv[1] = fac[1] = fac[0] = ifac[0] = ifac[1] = 1;
  FOR(i,2,N-1) {
    inv[i] = 1ll * (p - p / i) * inv[p%i] % p;
    fac[i] = 1ll * i * fac[i-1] % p;
    ifac[i] = 1ll * inv[i] * ifac[i-1] % p;
  }
  int n;
  rd(n);
  int ans = 1ll * fac[n*2] * ifac[n+1] % p;
  FOR(i,1,n) ans = (ans * 2) % p;
  O(ans);
}

int main() {
#ifndef MISAKA
#ifdef IOFILE
  freopen(IOFILE ".in", "r", stdin);
  freopen(IOFILE ".out", "w", stdout);
#endif
  ios::sync_with_stdio(0);
  cin.tie(0);
#endif
#ifdef MULTI
  int T;
  cin >> T;
  while (T--)
#endif
    sol();
  return 0;
}

提出情報

提出日時
問題 C - Split and Maximize
ユーザ misaka18931
言語 C++ (GCC 9.2.1)
得点 600
コード長 1948 Byte
結果 AC
実行時間 36 ms
メモリ 15352 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 600 / 600
結果
AC × 2
AC × 25
セット名 テストケース
Sample 00_sample_01.txt, 00_sample_02.txt
All 00_sample_01.txt, 00_sample_02.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt
ケース名 結果 実行時間 メモリ
00_sample_01.txt AC 34 ms 15224 KiB
00_sample_02.txt AC 28 ms 15248 KiB
01_small_01.txt AC 29 ms 15252 KiB
01_small_02.txt AC 33 ms 15316 KiB
01_small_03.txt AC 32 ms 15352 KiB
01_small_04.txt AC 32 ms 15220 KiB
01_small_05.txt AC 30 ms 15244 KiB
02_random_01.txt AC 26 ms 15188 KiB
02_random_02.txt AC 25 ms 15320 KiB
02_random_03.txt AC 27 ms 15220 KiB
02_random_04.txt AC 32 ms 15288 KiB
02_random_05.txt AC 27 ms 15232 KiB
02_random_06.txt AC 27 ms 15248 KiB
02_random_07.txt AC 31 ms 15240 KiB
02_random_08.txt AC 26 ms 15252 KiB
02_random_09.txt AC 31 ms 15308 KiB
02_random_10.txt AC 29 ms 15220 KiB
02_random_11.txt AC 26 ms 15228 KiB
02_random_12.txt AC 31 ms 15320 KiB
02_random_13.txt AC 31 ms 15192 KiB
02_random_14.txt AC 34 ms 15244 KiB
02_random_15.txt AC 31 ms 15248 KiB
02_random_16.txt AC 27 ms 15240 KiB
02_random_17.txt AC 36 ms 15244 KiB
02_random_18.txt AC 27 ms 15184 KiB