結果

問題 No.2391 SAN 値チェック
ユーザー 遭難者遭難者
提出日時 2023-07-21 23:13:01
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 895 bytes
コンパイル時間 8,776 ms
コンパイル使用メモリ 343,344 KB
実行使用メモリ 6,056 KB
最終ジャッジ日時 2023-10-21 23:14:01
合計ジャッジ時間 9,159 ms
ジャッジサーバーID
(参考情報)
judge10 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
6,052 KB
testcase_01 AC 6 ms
6,052 KB
testcase_02 AC 6 ms
6,052 KB
testcase_03 AC 28 ms
6,056 KB
testcase_04 AC 17 ms
6,056 KB
testcase_05 AC 25 ms
6,056 KB
testcase_06 AC 14 ms
6,056 KB
testcase_07 AC 14 ms
6,056 KB
testcase_08 AC 10 ms
6,056 KB
testcase_09 AC 14 ms
6,056 KB
testcase_10 AC 21 ms
6,056 KB
testcase_11 AC 7 ms
6,056 KB
testcase_12 AC 34 ms
6,056 KB
testcase_13 AC 36 ms
6,056 KB
testcase_14 AC 35 ms
6,056 KB
testcase_15 AC 35 ms
6,056 KB
testcase_16 AC 36 ms
6,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#ifndef DEBUG
#pragma GCC target("avx2")
#pragma GCC optimize("Ofast,unroll-loops")
#endif
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(a) a.begin(), a.end()
#define vc vector
#define ll long long
using namespace std;
using namespace atcoder;
using mint = modint998244353;
constexpr int INF = 3e5 + 2023;
mint fac[INF + 1];
mint fin[INF + 1];
void solve()
{
	fac[0] = 1;
	for (int i = 1; i <= INF; i++)
		fac[i] = i * fac[i - 1];
	fin[INF] = fac[INF].inv();
	for (int i = INF; i > 0; i--)
		fin[i - 1] = i * fin[i];
	int n;
	cin >> n;
	for (int i = 0; i <= n; i++)
	{
		mint ans = mint(i).pow(n - i) * fin[n - i];
		if ((n - i) % 2)
			ans *= -1;
		cout << ans.val() << '\n';
	}
}
int main()
{
	// srand((unsigned)time(NULL));
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(13);
	solve();
	return 0;
}
0