結果
問題 | No.2963 Mecha DESU |
ユーザー | liveworldlike |
提出日時 | 2024-11-16 16:58:21 |
言語 | C++23(gcc13) (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 227 ms / 2,000 ms |
コード長 | 2,468 bytes |
コンパイル時間 | 1,248 ms |
コンパイル使用メモリ | 89,920 KB |
実行使用メモリ | 25,552 KB |
最終ジャッジ日時 | 2024-11-16 16:59:17 |
合計ジャッジ時間 | 7,765 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | AC | 2 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | AC | 2 ms
5,248 KB |
testcase_11 | AC | 2 ms
5,248 KB |
testcase_12 | AC | 2 ms
5,248 KB |
testcase_13 | AC | 191 ms
25,032 KB |
testcase_14 | AC | 191 ms
25,216 KB |
testcase_15 | AC | 191 ms
25,212 KB |
testcase_16 | AC | 210 ms
25,088 KB |
testcase_17 | AC | 189 ms
25,204 KB |
testcase_18 | AC | 181 ms
25,304 KB |
testcase_19 | AC | 185 ms
25,144 KB |
testcase_20 | AC | 115 ms
17,600 KB |
testcase_21 | AC | 64 ms
11,008 KB |
testcase_22 | AC | 20 ms
6,656 KB |
testcase_23 | AC | 45 ms
8,876 KB |
testcase_24 | AC | 97 ms
16,384 KB |
testcase_25 | AC | 155 ms
19,416 KB |
testcase_26 | AC | 131 ms
20,992 KB |
testcase_27 | AC | 57 ms
11,776 KB |
testcase_28 | AC | 164 ms
22,080 KB |
testcase_29 | AC | 128 ms
18,176 KB |
testcase_30 | AC | 10 ms
5,248 KB |
testcase_31 | AC | 71 ms
12,032 KB |
testcase_32 | AC | 24 ms
6,656 KB |
testcase_33 | AC | 130 ms
19,928 KB |
testcase_34 | AC | 135 ms
20,224 KB |
testcase_35 | AC | 40 ms
8,960 KB |
testcase_36 | AC | 96 ms
18,688 KB |
testcase_37 | AC | 67 ms
9,600 KB |
testcase_38 | AC | 40 ms
8,832 KB |
testcase_39 | AC | 102 ms
18,868 KB |
testcase_40 | AC | 64 ms
12,160 KB |
testcase_41 | AC | 131 ms
19,644 KB |
testcase_42 | AC | 116 ms
17,372 KB |
testcase_43 | AC | 162 ms
24,336 KB |
testcase_44 | AC | 145 ms
23,040 KB |
testcase_45 | AC | 121 ms
19,072 KB |
testcase_46 | AC | 73 ms
12,920 KB |
testcase_47 | AC | 94 ms
14,796 KB |
testcase_48 | AC | 47 ms
9,444 KB |
testcase_49 | AC | 65 ms
13,176 KB |
testcase_50 | AC | 227 ms
25,552 KB |
testcase_51 | AC | 226 ms
25,512 KB |
testcase_52 | AC | 219 ms
25,472 KB |
testcase_53 | AC | 99 ms
19,180 KB |
testcase_54 | AC | 116 ms
19,200 KB |
testcase_55 | AC | 2 ms
5,248 KB |
testcase_56 | AC | 2 ms
5,248 KB |
testcase_57 | AC | 37 ms
19,176 KB |
testcase_58 | AC | 57 ms
9,984 KB |
testcase_59 | AC | 2 ms
5,248 KB |
ソースコード
// Sat Nov 16 10:36:03 2024 // Problem "No.2963 Mecha DESU" in contest "unknown_contest" #include <cmath> #include <map> #include <vector> #pragma GCC optimize("O3") #include <stdio.h> #ifdef NOJUDGE #define debug(...) fprintf(stderr, __VA_ARGS__) #else #define debug(...) #endif using namespace std; typedef long long int ll; const ll mod = 998244353; constexpr inline ll fastpow(ll x, ll p) { ll res = 1; while (p) { if (p & 1) res = res * x % mod; x = x * x % mod; p >>= 1; } return res; } constexpr inline ll inv(ll x) { return fastpow(x, mod - 2); } struct modint { ll x; double z; constexpr inline modint(ll x) : x(x % mod), z(x) {} constexpr inline modint(ll x, double z) : x(x % mod), z(z) {} constexpr inline modint operator+(modint y) { return modint(x + y.x, z + y.z); } constexpr inline modint operator-(modint y) { return modint(x - y.x, z - y.z); } constexpr inline modint operator*(modint y) { return modint(x * y.x, z * y.z); } constexpr inline modint operator/(modint y) { return modint(x * inv(y.x), z / y.z); } constexpr inline modint operator+=(modint y) { *this = *this + y; return *this; } constexpr inline modint operator-=(modint y) { *this = *this - y; return *this; } constexpr inline modint operator*=(modint y) { *this = *this * y; return *this; } constexpr inline modint operator/=(modint y) { *this = *this / y; return *this; } constexpr inline ll norm() { return (x + mod) % mod; } }; constexpr inline modint sqr(modint x) { return x * x; } constexpr inline modint fastpow(modint x, ll p) { return modint{fastpow(x.x, p), pow(x.z, p)}; } inline void solve() { ll n, m, k; scanf("%lld %lld %lld", &n, &m, &k); map<ll, ll> freq; for (ll i = 0; i < m; i++) { ll x; scanf("%lld", &x); freq[x]++; } modint invm = modint{1} / modint(m); const ll N = n + 10; vector<modint> P(N, 0); for (auto [card, count] : freq) { for (ll i = card; i < N; i += card) { P[i] += modint{count} * invm; } } modint res{0}; for (ll i = 1; i <= n; i++) { debug("P[%lld] = %f\n", i, P[i].z); res += modint{1} - fastpow(modint{1} - P[i], k); } printf("%lld\n", res.norm()); debug("%f\n", res.z); } #define yukicoder int main() { #if defined(Codeforces) || defined(CodeChef) ll t; scanf("%lld", &t); for (int i = 0; i < t; i++) { solve(); } #else solve(); #endif }