QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#88839 | #5356. esperar | Scintilla | 0 | 5ms | 4364kb | C++14 | 1.9kb | 2023-03-17 18:40:53 | 2023-03-17 18:40:57 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, e) for (int i = s; i <= e; ++i)
#define drep(i, s, e) for (int i = s; i >= e; --i)
#define file(a) freopen(#a".in", "r", stdin), freopen(#a".out", "w", stdout)
#define pv(a) cout << #a << " = " << a << endl
#define pa(a, l, r) cout << #a " : "; rep(_, l, r) cout << a[_] << ' '; cout << endl
const int P = 998244353;
const int N = 1e2 + 10;
const int M = 30;
int read() {
int x = 0, f = 1; char c = getchar();
for (; c < '0' || c > '9'; c = getchar()) if (c == '-') f = -1;
for (; c >= '0' && c <= '9'; c = getchar()) x = x * 10 + c - 48;
return x * f;
}
int inc(int a, int b) { return (a += b) >= P ? a - P : a; }
int dec(int a, int b) { return (a -= b) < 0 ? a + P : a; }
int mul(int a, int b) { return 1ll * a * b % P; }
void add(int &a, int b) { (a += b) >= P ? a -= P : 1; }
void sub(int &a, int b) { (a -= b) < 0 ? a += P : 1; }
int qpow(int a, int b) { int res = 1; for (; b; b >>= 1, a = mul(a, a)) if (b & 1) res = mul(res, a); return res; }
int n, a[N], c[N], ans = 1, same = 1;
struct node {
int dat[2 * N * M];
int& operator [] (int i) { return dat[i + N * M]; }
} f[N];
void work(int d) {
rep(i, 1, n) {
c[i] = 0;
while (!(a[i] % d)) ++ c[i], a[i] /= d;
ans = mul(ans, (c[i] + 1) * (c[i] + 2) / 2);
}
int lim = *max_element(c + 1, c + n + 1);
f[0][0] = 1;
rep(i, 1, n) rep(j, -i * lim, i * lim) f[i][j] = 0;
rep(i, 1, n) rep(j, -i * lim, i * lim) rep(d, -c[i], c[i]) {
add(f[i][j + d], mul(f[i - 1][j], (c[i] - abs(j)) / 2 + 1));
}
same = mul(same, f[n][0]);
}
int main() {
n = read();
rep(i, 1, n) a[i] = read();
rep(i, 1, n) {
for (int d = 2; d * d <= a[i]; ++ d) {
if (!(a[i] % d)) work(d);
}
if (a[i] > 1) work(a[i]);
}
ans = mul(inc(ans, same), (P + 1) / 2);
printf("%d\n", ans);
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 17
Accepted
time: 2ms
memory: 3428kb
input:
2 2 3
output:
5
result:
ok single line: '5'
Test #2:
score: -17
Wrong Answer
time: 0ms
memory: 3488kb
input:
4 5 8 8 9
output:
920
result:
wrong answer 1st lines differ - expected: '916', found: '920'
Subtask #2:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 2ms
memory: 4364kb
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:
65447008
result:
wrong answer 1st lines differ - expected: '476416688', found: '65447008'
Subtask #3:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 5ms
memory: 4324kb
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:
65447008
result:
wrong answer 1st lines differ - expected: '476416688', found: '65447008'