結果

問題 No.2197 Same Dish
ユーザー ああいいああいい
提出日時 2023-01-21 14:41:36
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 621 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 87,612 KB
最終ジャッジ日時 2023-09-06 03:55:32
合計ジャッジ時間 7,626 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,140 KB
testcase_01 AC 68 ms
71,092 KB
testcase_02 AC 67 ms
71,232 KB
testcase_03 AC 67 ms
71,136 KB
testcase_04 AC 67 ms
70,960 KB
testcase_05 AC 67 ms
71,040 KB
testcase_06 AC 69 ms
71,236 KB
testcase_07 AC 70 ms
71,332 KB
testcase_08 AC 69 ms
71,012 KB
testcase_09 AC 69 ms
71,340 KB
testcase_10 AC 70 ms
71,320 KB
testcase_11 AC 69 ms
70,824 KB
testcase_12 AC 67 ms
71,404 KB
testcase_13 AC 149 ms
78,904 KB
testcase_14 AC 541 ms
86,872 KB
testcase_15 AC 589 ms
87,244 KB
testcase_16 AC 412 ms
84,168 KB
testcase_17 AC 373 ms
83,580 KB
testcase_18 AC 600 ms
87,068 KB
testcase_19 AC 607 ms
87,268 KB
testcase_20 AC 621 ms
87,612 KB
testcase_21 AC 606 ms
87,492 KB
testcase_22 AC 596 ms
87,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
l = []
for _ in range(N):
    L,R = map(int,input().split())
    l.append((L,1))
    l.append((R,-1))

l.sort()
tmp = 1
num = 0
P = 998244353
for t,i in l:
    if i == 1:
        tmp *= (K - num)
        tmp %= P
        num += 1
    else:
        num -= 1
ans = pow(K,N,P) - tmp
print(ans%P)
0