結果

問題 No.2197 Same Dish
ユーザー ニックネームニックネーム
提出日時 2023-01-20 22:20:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 614 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 221 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 31,112 KB
最終ジャッジ日時 2023-09-05 14:38:18
合計ジャッジ時間 6,619 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,888 KB
testcase_01 AC 16 ms
7,892 KB
testcase_02 AC 16 ms
7,844 KB
testcase_03 AC 16 ms
7,888 KB
testcase_04 AC 16 ms
7,888 KB
testcase_05 AC 16 ms
7,772 KB
testcase_06 AC 16 ms
7,768 KB
testcase_07 AC 16 ms
7,764 KB
testcase_08 AC 16 ms
7,760 KB
testcase_09 AC 15 ms
7,848 KB
testcase_10 AC 16 ms
7,908 KB
testcase_11 AC 16 ms
7,892 KB
testcase_12 AC 15 ms
7,832 KB
testcase_13 AC 84 ms
11,208 KB
testcase_14 AC 536 ms
28,068 KB
testcase_15 AC 599 ms
30,448 KB
testcase_16 AC 391 ms
22,780 KB
testcase_17 AC 338 ms
21,260 KB
testcase_18 AC 603 ms
30,788 KB
testcase_19 AC 609 ms
30,768 KB
testcase_20 AC 614 ms
31,112 KB
testcase_21 AC 599 ms
31,036 KB
testcase_22 AC 582 ms
30,780 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
lr = []
for _ in range(n):
    l,r = map(int,input().split())
    lr.append((l,1)); lr.append((r,0))
mod = 998244353; c = 0; x = 1
for _,f in sorted(lr):
    if f: x = x*max(k-c,0)%mod; c += 1
    else: c -= 1
print((pow(k,n,mod)-x)%mod)
0