結果

問題 No.2197 Same Dish
ユーザー ntudantuda
提出日時 2023-01-22 21:41:27
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 366 bytes
コンパイル時間 547 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 93,084 KB
最終ジャッジ日時 2023-09-07 05:40:48
合計ジャッジ時間 8,937 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,288 KB
testcase_01 AC 80 ms
71,424 KB
testcase_02 AC 78 ms
71,620 KB
testcase_03 AC 80 ms
71,404 KB
testcase_04 AC 81 ms
71,352 KB
testcase_05 AC 80 ms
71,404 KB
testcase_06 AC 80 ms
71,196 KB
testcase_07 AC 80 ms
71,344 KB
testcase_08 WA -
testcase_09 AC 78 ms
71,332 KB
testcase_10 WA -
testcase_11 AC 82 ms
71,404 KB
testcase_12 WA -
testcase_13 AC 206 ms
79,912 KB
testcase_14 AC 517 ms
90,180 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 575 ms
91,784 KB
testcase_20 WA -
testcase_21 AC 480 ms
93,084 KB
testcase_22 AC 450 ms
88,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
from heapq import *

N, K = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(N)]
LR.sort()
q = []
cnt = 0
All = pow(K, N, MOD)
tmp = 1
for l, r in LR:
    if q:
        while q and q[0] <= l:
            cnt -= 1
            heappop(q)
    tmp *= (K - cnt)
    tmp %= MOD
    cnt += 1
    heappush(q,r)
print(All - tmp)
0