結果
問題 | No.2197 Same Dish |
ユーザー | minimum |
提出日時 | 2023-01-20 21:46:12 |
言語 | PyPy3 (7.3.13) |
結果 |
TLE
|
実行時間 | - |
コード長 | 420 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 87,260 KB |
実行使用メモリ | 265,752 KB |
最終ジャッジ日時 | 2023-09-05 14:00:44 |
合計ジャッジ時間 | 5,739 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 78 ms
75,972 KB |
testcase_01 | AC | 80 ms
71,136 KB |
testcase_02 | AC | 78 ms
71,608 KB |
testcase_03 | AC | 77 ms
71,276 KB |
testcase_04 | AC | 78 ms
71,688 KB |
testcase_05 | AC | 78 ms
71,584 KB |
testcase_06 | AC | 78 ms
71,512 KB |
testcase_07 | AC | 79 ms
71,412 KB |
testcase_08 | AC | 76 ms
71,552 KB |
testcase_09 | AC | 76 ms
71,592 KB |
testcase_10 | AC | 77 ms
71,632 KB |
testcase_11 | AC | 76 ms
71,380 KB |
testcase_12 | AC | 79 ms
71,488 KB |
testcase_13 | AC | 303 ms
79,172 KB |
testcase_14 | TLE | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
ソースコード
MOD = 998244353 N, K = map(int, input().split()) event = [] for i in range(N): l, r = map(int, input().split()) event.append((l, 1)) event.append((r, 0)) event.sort() cnt = 0 ans = 1 for i in range(2 * N): x, t = event[i] if t == 1: if cnt == K: ans = 0 else: ans *= K - cnt cnt += 1 else: cnt -= 1 print((pow(K, N, MOD) - ans) % MOD)