結果

問題 No.2199 lower_bound and upper_bound
ユーザー lddlinanlddlinan
提出日時 2023-03-14 22:49:01
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,329 bytes
コンパイル時間 708 ms
コンパイル使用メモリ 86,256 KB
実行使用メモリ 4,444 KB
最終ジャッジ日時 2023-10-18 12:06:55
合計ジャッジ時間 1,898 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,348 KB
testcase_08 WA -
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 4 ms
4,444 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 3 ms
4,348 KB
testcase_21 WA -
testcase_22 AC 3 ms
4,348 KB
testcase_23 WA -
testcase_24 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;

bool rcmp(int a, int b) { return a>b; }
typedef long long LL;


#define MOD 998244353
int expit(LL b, int e) {
    if (b<0) return 0;
    LL r=1;
    while(e) {
        if (e&1)  {r*=b; r%=MOD; }
        b*=b; b%=MOD;
        e>>=1;
    }
    return r;
}

int ff[300004];
int main() {
    int n, i, l, u;
    LL v, r=0;
    scanf("%d %d %d", &n, &l, &u);
    ff[0]=1;
    for (i=1; i<=n+n+u+2; i++) {
        v=ff[i-1]; v*=i; v%=MOD;
        ff[i]=v;
    }
    r=ff[n+n+u];
    r*=expit(ff[n], MOD-2); r%=MOD;
    r*=expit(ff[n+u], MOD-2); r%=MOD;
    v=ff[n+n+l-1];
    v*=expit(ff[n], MOD-2); v%=MOD;
    v*=expit(ff[n+l-1], MOD-2); v%=MOD;
    r-=v; if (r<0) r+=MOD;
    if (n-2>=0) {
        v=ff[n+n+u];
        v*=expit(ff[n+u+2], MOD-2); v%=MOD;
        v*=expit(ff[n-2], MOD-2); v%=MOD;
        r-=v; if (r<0) r+=MOD;
    }
    if (n+l-u-3>=0) {
        v=ff[n+n+l-1];
        v*=expit(ff[n+u+2], MOD-2); v%=MOD;
        v*=expit(ff[n+l-u-3], MOD-2); v%=MOD;
        r-=v; if (r<0) r+=MOD;
    }
    printf("%lld\n", r); 
    return 0;
}
0