結果
| 問題 | No.2963 Mecha DESU |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-20 03:23:57 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
RE
不安定
|
| 実行時間 | - |
| コード長 | 1,976 bytes |
| 記録 | |
| コンパイル時間 | 1,776 ms |
| コンパイル使用メモリ | 176,724 KB |
| 実行使用メモリ | 19,200 KB |
| 最終ジャッジ日時 | 2026-09-20 03:24:14 |
| 合計ジャッジ時間 | 14,278 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | AC * 13 RE * 44 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
const ll MOD=998244353;
struct mint{
ll val;
mint(ll val_=0):val(val_%MOD){
if(val<0) val+=MOD;
}
mint operator-()const{
return mint(-val);
}
mint& operator+=(const mint& other){
val+=other.val;
if(val>=MOD) val-=MOD;
return *this;
}
mint& operator-=(const mint& other){
val-=other.val;
if(val<0) val+=MOD;
return *this;
}
mint& operator*=(const mint& other){
val*=other.val, val%=MOD;
return *this;
}
mint pow(ll n) const{
mint ans(1);
mint mul(*this);
while(n){
if(n&1) ans*=mul;
mul*=mul;
n/=2;
}
return ans;
}
mint inv() const{
return pow(MOD-2);
}
mint& operator/=(const mint& other){
return *this*=other.inv();
}
friend bool operator==(const mint& lhs, const mint& rhs){
return lhs.val == rhs.val;
}
friend bool operator!=(const mint& lhs, const mint& rhs){
return lhs.val != rhs.val;
}
friend mint operator+(mint lhs, const mint& rhs) {
lhs+=rhs;
return lhs;
}
friend mint operator-(mint lhs, const mint& rhs) {
lhs-=rhs;
return lhs;
}
friend mint operator*(mint lhs, const mint& rhs) {
lhs*=rhs;
return lhs;
}
friend mint operator/(mint lhs, const mint& rhs) {
lhs/=rhs;
return lhs;
}
friend istream& operator>>(istream& is, mint& m) {
ll x;
is >> x;
m=mint(x);
return is;
}
friend ostream& operator<<(ostream& os, const mint& m) {
return os << m.val;
}
};
int main(void){
int n, m, k; cin >> n >> m >> k;
vector<mint> cnt(n+1), ca(1e6+1);
for(int i=0; i<m; i++){
int a; cin >> a;
ca[a]+=1;
}
for(int i=1; i<=1e6; i++)if(ca[i].val){
int ni=i;
while(ni<=1e6){
cnt[ni]+=ca[i];
ni+=i;
}
}
mint ans=0;
for(int i=1; i<=n; i++) ans+=mint(1)-mint(mint(m-cnt[i])/m).pow(k);
cout << ans << endl;
return 0;
}