結果
問題 | No.2230 Good Omen of White Lotus |
ユーザー |
![]() |
提出日時 | 2023-02-24 23:33:47 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 917 ms / 2,000 ms |
コード長 | 521 bytes |
コンパイル時間 | 205 ms |
コンパイル使用メモリ | 82,012 KB |
実行使用メモリ | 99,016 KB |
最終ジャッジ日時 | 2024-09-13 06:11:38 |
合計ジャッジ時間 | 15,682 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
ソースコード
class BIT:def __init__(self, n):self.n = n; self.k = [0]*(n+1)def u(self, i, x):while i <= self.n: self.k[i] = max(self.k[i], x); i += i&-idef m(self, i):t = 0while i > 0: t = max(t, self.k[i]); i -= i&-ireturn th,w,n,p = map(int,input().split())xy = [tuple(map(int,input().split())) for _ in range(n)]m = 998244353; bit = BIT(w+1)for x,y in sorted(xy): bit.u(y,bit.m(y)+1)c = bit.m(w)print((1-pow(p-1,h+w-3-c,m)*pow(p-2,c,m)*pow(pow(p,h+w-3,m),m-2,m))%m)