結果

問題 No.2197 Same Dish
ユーザー SidewaysOwlSidewaysOwl
提出日時 2023-01-21 00:22:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 762 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 101,196 KB
最終ジャッジ日時 2023-09-05 16:50:35
合計ジャッジ時間 8,596 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,292 KB
testcase_01 AC 74 ms
71,560 KB
testcase_02 AC 74 ms
71,320 KB
testcase_03 AC 73 ms
71,464 KB
testcase_04 AC 74 ms
71,268 KB
testcase_05 AC 74 ms
71,600 KB
testcase_06 AC 73 ms
71,268 KB
testcase_07 AC 74 ms
71,444 KB
testcase_08 AC 75 ms
71,168 KB
testcase_09 AC 73 ms
71,368 KB
testcase_10 AC 75 ms
71,188 KB
testcase_11 AC 75 ms
71,444 KB
testcase_12 AC 75 ms
71,372 KB
testcase_13 AC 161 ms
79,580 KB
testcase_14 AC 639 ms
96,148 KB
testcase_15 AC 724 ms
100,940 KB
testcase_16 AC 488 ms
93,208 KB
testcase_17 AC 417 ms
88,496 KB
testcase_18 AC 740 ms
100,000 KB
testcase_19 AC 762 ms
101,196 KB
testcase_20 AC 745 ms
100,924 KB
testcase_21 AC 745 ms
100,804 KB
testcase_22 AC 676 ms
100,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())
mod = 998244353 

arr = []
for i in range(n):
    l,r = map(int,input().split())
    arr.append((l,1,i))
    arr.append((r,0,i))
arr.sort()
cnt = 0
ans = 1
for x,io,l in arr:
    if io == 1:
        ans *= k-cnt
        ans %= mod
        cnt += 1
    else:
        cnt -= 1
print((pow(k,n,mod)-ans) % mod)
0