結果
問題 | No.3095 Many Min Problems |
ユーザー |
![]() |
提出日時 | 2025-04-06 15:50:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 72 ms / 2,000 ms |
コード長 | 1,570 bytes |
コンパイル時間 | 2,903 ms |
コンパイル使用メモリ | 192,808 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-04-06 15:50:24 |
合計ジャッジ時間 | 4,820 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
// g++-13 2.cpp -std=c++20 -O2 -I . #include <bits/stdc++.h> using namespace std; #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> #include<ext/pb_ds/tag_and_trait.hpp> using namespace __gnu_pbds; #include <atcoder/modint> using namespace atcoder; using ll = long long; using ld = long double; using vi = vector<int>; using vvi = vector<vi>; using vll = vector<ll>; using vvll = vector<vll>; using vld = vector<ld>; using vvld = vector<vld>; using vst = vector<string>; using vvst = vector<vst>; #define fi first #define se second #define pb push_back #define eb emplace_back #define pq_big(T) priority_queue<T,vector<T>,less<T>> #define pq_small(T) priority_queue<T,vector<T>,greater<T>> #define all(a) a.begin(),a.end() #define rep(i,start,end) for(ll i=start;i<(ll)(end);i++) #define per(i,start,end) for(ll i=start;i>=(ll)(end);i--) #define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end()) random_device seed; mt19937_64 randint(seed()); ll grr(ll mi, ll ma) { // [mi, ma) return mi + randint() % (ma - mi); } using mint = modint998244353; int main(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n,m;cin>>n>>m; mint ans=0; rep(v,1,m+1){ // min >= v なる i の個数の期待値 mint prob=m-v+1; prob/=m; // prob=1-prob; if(prob.val()==1){ ans+=n; continue; } mint c=prob.pow(n); c=(1-c)/(1-prob); c*=prob; ans+=c; } rep(i,0,n){ ans*=m; } cout<<ans.val()<<endl; }