結果

問題 No.2197 Same Dish
ユーザー titiatitia
提出日時 2023-01-23 01:15:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 292 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 22,464 KB
最終ジャッジ日時 2023-09-07 07:55:49
合計ジャッジ時間 6,087 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,432 KB
testcase_01 AC 18 ms
8,456 KB
testcase_02 AC 18 ms
8,488 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 18 ms
8,368 KB
testcase_06 AC 18 ms
8,484 KB
testcase_07 AC 18 ms
8,432 KB
testcase_08 WA -
testcase_09 AC 18 ms
8,504 KB
testcase_10 WA -
testcase_11 AC 18 ms
8,440 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 405 ms
22,412 KB
testcase_22 AC 429 ms
22,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N,K=map(int,input().split())
LR=[tuple(map(int,input().split())) for i in range(N)]

LR.sort()
ANS=1
mod=998244353

Q=deque()

for l,r in LR:
    while Q and Q[0]<=l:
        Q.popleft()

    ANS=ANS*(K-len(Q))%mod
    Q.append(r)

print((pow(K,N,mod)-ANS)%mod)
0