結果

問題 No.2176 LRM Question 1
ユーザー 👑 NachiaNachia
提出日時 2023-01-06 21:25:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 969 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 79,240 KB
実行使用メモリ 10,964 KB
最終ジャッジ日時 2023-08-20 14:26:13
合計ジャッジ時間 2,129 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 17 ms
10,764 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 16 ms
10,808 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 16 ms
10,748 KB
testcase_09 AC 16 ms
10,588 KB
testcase_10 AC 15 ms
9,492 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 16 ms
10,964 KB
testcase_14 AC 18 ms
10,872 KB
testcase_15 AC 15 ms
9,280 KB
testcase_16 AC 12 ms
7,948 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 15 ms
10,080 KB
testcase_19 AC 11 ms
7,776 KB
testcase_20 AC 5 ms
4,576 KB
testcase_21 AC 9 ms
6,252 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 8 ms
5,608 KB
testcase_24 AC 9 ms
6,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <atcoder/modint>
using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
const i64 INF = 1001001001001001001;

using Modint = atcoder::dynamic_modint<998244353>;

int main(){
    i64 L, R; cin >> L >> R; R++;
    int M; cin >> M;
    Modint::set_mod(M);
    R = min<i64>(R, M);
    L = min<i64>(L, M);
    Modint ans = 0;
    vector<Modint> F(M);
    F[0] = 1;
    for(int i=1; i<M; i++) F[i] = F[i-1] * Modint::raw(i);
    vector<Modint> FF(M+1);
    FF[0] = 1;
    for(int i=1; i<=M; i++) FF[i] = FF[i-1] * F[i];
    for(i64 a=L; a<R; a++){
        ans += FF[a];
    }
    cout << ans.val() << endl;
    return 0;
}



struct ios_do_not_sync{
    ios_do_not_sync(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
    }
} ios_do_not_sync_instance;

0