結果
| 問題 | No.3160 Party Game |
| コンテスト | |
| ユーザー |
ha_chan
|
| 提出日時 | 2025-05-23 20:02:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 899 bytes |
| 記録 | |
| コンパイル時間 | 2,107 ms |
| コンパイル使用メモリ | 194,904 KB |
| 実行使用メモリ | 19,280 KB |
| 最終ジャッジ日時 | 2025-05-27 22:00:01 |
| 合計ジャッジ時間 | 13,989 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 37 WA * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef vector<VL> VVL;
typedef long long LL;
#define all(a) (a).begin(), (a).end()
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#include <atcoder/modint>
using mint = atcoder::modint998244353;
mint fac[2000001],gf[2000001];
mint f(int n,int m){
return fac[n]*gf[m]*gf[n-m];
}
int main() {
fac[0]=1;gf[0]=1;
for(int i=1;i<=2000000;i++){fac[i]=fac[i-1]*i; gf[i]=1/fac[i];}
int n,m;cin>>n>>m;
mint ans=0;
mint mae=0;
for(int a=m-1;a>0;a--){
if(LL(m)>=LL(a)*n){
mint mmm=f(m-a*n+n,n);
ans+=a*(mmm-mae);
mae=mmm;
}
}
//cout<<mae.val()<<endl;
mae=f(m+n,n)-n;
//cout<<mae.val()<<endl;
ans/=mae;
cout<<ans.val()<<endl;
}
ha_chan