結果
| 問題 |
No.2409 Strange Werewolves
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-08-11 21:48:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 85 ms / 2,000 ms |
| コード長 | 589 bytes |
| コンパイル時間 | 1,405 ms |
| コンパイル使用メモリ | 170,924 KB |
| 実行使用メモリ | 8,064 KB |
| 最終ジャッジ日時 | 2024-11-18 15:52:42 |
| 合計ジャッジ時間 | 3,586 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 16 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/modint>
using namespace atcoder;
using mint=modint998244353;
int main(void) {
constexpr int maxi=6e5;
int x,y,z,w;
cin >> x >> y >> z >> w;
vector<mint> fact(maxi+1,1);
vector<mint> finv(maxi+1,1);
for(int i=2;i<=maxi;++i){
fact[i]=fact[i-1]*i;
finv[i]=finv[i-1]/i;
}
mint ans=fact[x-z+y-w-1];
if(z==0){
swap(x,y);
swap(z,w);
}
ans*=fact[x]*finv[z]*finv[x-z];
ans*=fact[y]*finv[w+1]*finv[y-w-1];
cout << ans.val() << endl;
return 0;
}