結果

問題 No.2197 Same Dish
ユーザー tassei903tassei903
提出日時 2023-01-20 22:55:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 627 ms / 2,000 ms
コード長 669 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 91,304 KB
最終ジャッジ日時 2023-09-05 15:21:00
合計ジャッジ時間 7,675 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,188 KB
testcase_01 AC 78 ms
71,212 KB
testcase_02 AC 74 ms
71,328 KB
testcase_03 AC 74 ms
71,192 KB
testcase_04 AC 72 ms
71,096 KB
testcase_05 AC 72 ms
70,840 KB
testcase_06 AC 72 ms
71,376 KB
testcase_07 AC 73 ms
71,260 KB
testcase_08 AC 73 ms
71,188 KB
testcase_09 AC 72 ms
71,204 KB
testcase_10 AC 71 ms
71,100 KB
testcase_11 AC 71 ms
70,852 KB
testcase_12 AC 71 ms
71,296 KB
testcase_13 AC 146 ms
79,104 KB
testcase_14 AC 549 ms
87,908 KB
testcase_15 AC 600 ms
90,664 KB
testcase_16 AC 416 ms
84,548 KB
testcase_17 AC 376 ms
84,124 KB
testcase_18 AC 613 ms
90,492 KB
testcase_19 AC 617 ms
90,916 KB
testcase_20 AC 622 ms
91,304 KB
testcase_21 AC 627 ms
91,000 KB
testcase_22 AC 613 ms
91,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

n, k = na()
eve = []
for _ in range(n):
    l,r = na()
    eve.append((l,1))
    eve.append((r,-1))
eve = sorted(eve)
ans = 1
z = 0
mod = 998244353
for x, i in eve:
    if i == 1:
        ans *= k - z
        ans %= mod
        z += 1
    else:
        z -= 1
    #print(x,i,z,ans)


print((pow(k, n,mod)-ans)%mod)
0