結果
問題 | No.2230 Good Omen of White Lotus |
ユーザー |
![]() |
提出日時 | 2023-08-08 12:43:30 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 865 bytes |
コンパイル時間 | 5,770 ms |
コンパイル使用メモリ | 318,012 KB |
実行使用メモリ | 28,032 KB |
最終ジャッジ日時 | 2024-11-08 18:24:56 |
合計ジャッジ時間 | 23,784 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 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+1); mint t=2; t/=p; mint ans=t.pow(ax); t/=2; ans*=t.pow(h+w-2-ax); cout<<ans.val(); }