結果
問題 | No.2384 Permutations of Permutations |
ユーザー |
![]() |
提出日時 | 2023-07-14 22:39:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 2,139 bytes |
コンパイル時間 | 4,293 ms |
コンパイル使用メモリ | 250,384 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 07:43:09 |
合計ジャッジ時間 | 5,182 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
//#define _GLIBCXX_DEBUG#include <bits/stdc++.h>#include <atcoder/all>#include <ext/pb_ds/assoc_container.hpp>using namespace __gnu_pbds;template <typename T>using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;using namespace std;#define all(n) begin(n), end(n)const long long INF = INT_MAX / 2;typedef long long ll;typedef vector<int> vint;typedef vector<vector<int>> vvint;typedef vector<ll> vll;typedef vector<vector<ll>> vvll;typedef unsigned long long ull;template <class T>bool chmax(T &a, const T &b){if (a < b){a = b;return 1;}return 0;}template <class T>bool chmin(T &a, const T &b){if (b < a){a = b;return 1;}return 0;}template <typename T>vector<T> make_v(size_t a) { return vector<T>(a); }template <typename T, typename... Ts>auto make_v(size_t a, Ts... ts){return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));}template <typename T, typename V>typename enable_if<is_class<T>::value == 0>::typefill_v(T &t, const V &v) { t = v; }template <typename T, typename V>typename enable_if<is_class<T>::value != 0>::typefill_v(T &t, const V &v){for (auto &e : t)fill_v(e, v);}using mint = atcoder::modint998244353;int main(){ios::sync_with_stdio(false);cin.tie(0);int n, k;cin >> n >> k;mint ans = 0;if (n != 2){mint fact = 1;for (int i = 1; i <= n-k; i++){fact *= i;}if (n != 6) {cout << (k * fact).val() << endl;}else {ans = k * fact;if (k == 2) {ans += 6 * 24;}if (k == 3) {ans += 36;}if (k == 4){ans += 8;}if(k == 5) {ans += 5;}if (k == 6){}cout << ans.val() << endl;}}else if (n == 2){// Aut(S_2) = 1cout << 1 << endl;}return 0;}