結果
| 問題 |
No.2133 Take it easy!
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2022-11-28 16:29:33 |
| 言語 | cLay (20241019-1) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 438 bytes |
| コンパイル時間 | 8,326 ms |
| コンパイル使用メモリ | 237,884 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-05 15:17:57 |
| 合計ジャッジ時間 | 9,361 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 26 |
ソースコード
#define MD 998244353
Comb<Mint> comb;
inline
Mint cat(ll b){
return b&1?Mint():comb.fac(b)*comb.ifac((b>>1)+1)*comb.ifac(b>>1);
}
{
ll@n,@q,@lr[2q],in[];
rep(j,q)++lr[2j+1];
sortA_index(2q,lr,in);
unordered_map<ull,ll>m;
ull b=0;
ll x=0;
Mint z=comb.fac(n/2)*comb.fac((n+1)/2);
rep(j,2q){
ll i=in[j];
ll l=lr[j];
m[b]+=l-x;
x=l;
b^=1ull<<(i>>1);
}
m[0]+=n+(n&1)-x;
for(auto t:m){
z*=cat(t.second);
}
wt(z);
}
tails