結果
問題 |
No.3153 probability max K
|
ユーザー |
![]() |
提出日時 | 2025-05-10 13:30:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 177 ms / 2,000 ms |
コード長 | 465 bytes |
コンパイル時間 | 4,402 ms |
コンパイル使用メモリ | 254,464 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-05-10 13:30:17 |
合計ジャッジ時間 | 8,251 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; signed main(){ int n,k;cin>>n>>k; vector<long long> a(n); for(long long &i:a)cin>>i; sort(a.begin(),a.end()); modint998244353 ans=0,now=1,rp=1,g=k-1; for(int i=n-1;i>=0;i--){ if(a[i]<k)break; rp*=a[i]; } for(int i=0;i<n;i++){ if(a[i]<k)continue; ans+=now*g.pow(n-i-1)/rp; rp/=a[i]; now*=k,now/=a[i]; } cout<<ans.val()<<endl; }