QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#73670 | #5356. esperar | Linshey | 0 | 9ms | 19136kb | C++14 | 1.0kb | 2023-01-27 15:33:58 | 2023-01-27 15:34:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std; const int maxn = 1e2 + 5, mod = 998244353, maxm = 2e3 + 5; typedef long long ll;
int n, a[maxn];
map<int, int> mp;
inline void add(int x)
{
for (int i = 2; i * i <= x; i++) if (x % i == 0) while (x % i == 0) mp[i]++, x /= i;
if (x != 1) mp[x]++;
}
int C[maxm][maxm], F[maxm], P[maxm];
int main()
{
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", a + i), add(a[i]);
for (int i = 0; i < maxm; i++) for (int j = C[i][0] = 1; j <= i; j++) if ((C[i][j] = C[i - 1][j - 1] + C[i - 1][j]) >= mod) C[i][j] -= mod;
for (int i = 1; i < maxm; i++) for (int j = 0; j <= i; j += 2) F[i] = (F[i] + (ll)C[i][j] * C[j][j / 2]) % mod;
for (int i = P[0] = 1; i < maxm; i++) P[i] = (P[i - 1] * 3ll) % mod;
int A = 1, B = 1;
for (auto it = mp.begin(); it != mp.end(); it++) A = (ll)A * P[it->second] % mod;
for (auto it = mp.begin(); it != mp.end(); it++) B = (ll)B * F[it->second] % mod;
return 0 * printf("%lld\n", (ll)(mod - mod / 2) * (A + B) % mod);
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 17
Accepted
time: 9ms
memory: 19136kb
input:
2 2 3
output:
5
result:
ok single line: '5'
Test #2:
score: -17
Wrong Answer
time: 7ms
memory: 19036kb
input:
4 5 8 8 9
output:
10053
result:
wrong answer 1st lines differ - expected: '916', found: '10053'
Subtask #2:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 5ms
memory: 18380kb
input:
100 78125 625 244140625 9765625 390625 9765625 244140625 3125 125 244140625 1 78125 25 48828125 25 3125 15625 9765625 25 125 9765625 1 625 125 244140625 3125 15625 48828125 9765625 1 125 390625 1953125 15625 1 5 9765625 5 48828125 125 9765625 25 5 48828125 390625 25 125 390625 9765625 9765625 625 31...
output:
895178613
result:
wrong answer 1st lines differ - expected: '476416688', found: '895178613'
Subtask #3:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 3ms
memory: 18868kb
input:
100 78125 625 244140625 9765625 390625 9765625 244140625 3125 125 244140625 1 78125 25 48828125 25 3125 15625 9765625 25 125 9765625 1 625 125 244140625 3125 15625 48828125 9765625 1 125 390625 1953125 15625 1 5 9765625 5 48828125 125 9765625 25 5 48828125 390625 25 125 390625 9765625 9765625 625 31...
output:
895178613
result:
wrong answer 1st lines differ - expected: '476416688', found: '895178613'