結果
問題 | No.2230 Good Omen of White Lotus |
ユーザー |
![]() |
提出日時 | 2023-08-08 12:48:45 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 325 ms / 2,000 ms |
コード長 | 903 bytes |
コンパイル時間 | 5,864 ms |
コンパイル使用メモリ | 318,284 KB |
実行使用メモリ | 28,032 KB |
最終ジャッジ日時 | 2024-11-08 18:29:34 |
合計ジャッジ時間 | 11,593 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 44 |
ソースコード
#include<bits/stdc++.h>using namespace std;#include <atcoder/all>using namespace atcoder;using mint=modint998244353; //1000000007;using ll=long long;using pp=pair<int,int>;#define sr string#define vc vector#define fi first#define se second#define rep(i,n) for(int i=0;i<(int)n;i++)#define pb push_back#define all(v) v.begin(),v.end()#define pque priority_queue#define bpc(a) __builtin_popcount(a)int op(int a,int b){return max(a,b);}int e(){return -1e8;}int main(){int h,w,n,p;cin>>h>>w>>n>>p;map<int,vc<int>>m;rep(i,n){int a,b;cin>>a>>b; a--;b--;m[a].pb(b);}for(auto&[z,a]:m)sort(all(a));segtree<int,op,e>sg(w);sg.set(0,0);for(auto [z,v]:m){for(auto x:v){int a=sg.prod(0,x+1);sg.set(x,a+1);}}int ax=sg.prod(0,w);mint t=2; t/=p;mint ans=(1-t).pow(ax);t/=2;ans*=(1-t).pow(h+w-3-ax);ans=1-ans;cout<<ans.val();//cout<<"\n"<<ax;}