結果

問題 No.2068 Restricted Permutation
ユーザー 遭難者遭難者
提出日時 2022-08-27 13:03:08
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 1,021 bytes
コンパイル時間 19,018 ms
コンパイル使用メモリ 241,692 KB
最終ジャッジ日時 2025-01-31 06:23:09
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 TLE * 1
other AC * 10 TLE * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <string>
#include <stack>
#include <numeric>
#include <algorithm>
using namespace std;
using ll = long long;
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
void chmin(ll &a, ll b)
{
    if (a > b)
        a = b;
}
void chmax(ll &a, ll b)
{
    if (a < b)
        a = b;
}
int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, k, x;
    cin >> n >> k >> x;
    vector<int> v(n);
    iota(ALL(v), 1);
    mint ans = 0, now = 0;
    do
    {
        if (v[k - 1] == x)
            ans += now;
        now++;
    } while (next_permutation(ALL(v)));
    cout << ans.val() << endl;
    return 0;
}
0