QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#85337 | #5356. esperar | xiaoyaowudi | 17 | 3ms | 3584kb | C++14 | 1.2kb | 2023-03-07 16:26:44 | 2023-03-07 16:26:50 |
Judging History
answer
#include <iostream>
#include <algorithm>
constexpr int N(110),p(998244353);
int main()
{
int b(1);
int n;std::cin>>n;
static std::pair<int,int> ps[N*N];int k(0);
while(n--)
{
int t;std::cin>>t;
for(int i(2);i*i<=t;++i) if((t%i)==0)
{
int c(0);
while((t%i)==0) ++c,t/=i;
b=1ll*b*((c+1)*(c+2)/2)%p;
ps[++k]={i,c};
}
if(t>1) b=3ll*b%p,ps[++k]={t,1};
}
std::sort(ps+1,ps+k+1);
int w(1);
for(int l(1),r;l<=k;l=r)
{
int tot(0);
for(r=l;r<=k && ps[r].first==ps[l].first;++r) tot+=ps[r].second;
// std::cerr<<ps[l].first<<" "<<tot<<std::endl;
constexpr int L(1000);
static int f[L],g[L];f[tot]=1;
for(int i(l);i<r;++i)
{
for(int j(0);j<=(tot*2);++j) g[j]=f[j],f[j]=0;
for(int j(-ps[i].second);j<=ps[i].second;++j)
{
int v;
if(j>=0) v=(ps[i].second-j)/2+1;
else v=(ps[i].second+j)/2+1;
// std::cerr<<v<<" ";
for(int t(0);t<=(tot*2);++t) if(g[t]) f[t+j]=(f[t+j]+1ll*g[t]*v)%p;
}
// std::cerr<<std::endl;
}
w=1ll*w*f[tot]%p;
for(int t(0);t<=(tot*2);++t) f[t]=0;
}
// std::cout<<a<<" "<<b<<" "<<w<<std::endl;
std::cout<<1ll*(b+w)*((p+1)/2)%p<<std::endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 17
Accepted
Test #1:
score: 17
Accepted
time: 2ms
memory: 3388kb
input:
2 2 3
output:
5
result:
ok single line: '5'
Test #2:
score: 0
Accepted
time: 2ms
memory: 3392kb
input:
4 5 8 8 9
output:
916
result:
ok single line: '916'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3404kb
input:
5 4 8 7 4 10
output:
4939
result:
ok single line: '4939'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3584kb
input:
5 2 7 7 10 10
output:
1125
result:
ok single line: '1125'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3284kb
input:
4 5 5 4 3
output:
84
result:
ok single line: '84'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
4 5 5 6 4
output:
249
result:
ok single line: '249'
Subtask #2:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 3ms
memory: 3428kb
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:
668087630
result:
wrong answer 1st lines differ - expected: '476416688', found: '668087630'
Subtask #3:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 0ms
memory: 3448kb
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:
668087630
result:
wrong answer 1st lines differ - expected: '476416688', found: '668087630'