QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#186476 | #5356. esperar | grass8cow | 0 | 2ms | 3916kb | C++14 | 1.1kb | 2023-09-23 22:13:39 | 2023-09-23 22:13:39 |
answer
#include<bits/stdc++.h>
using namespace std;
int n,a[110];
const int mod=998244353,N=1e9,inv2=(mod+1)/2;
int p[101000],c;
bool fl[101000];
void sieve(){
int E=(int)sqrt(N);
for(int i=2;i<=E;i++)if(!fl[i]){
p[++c]=i;
for(int j=2;i*j<=E;j++)fl[i*j]=1;
}
}
const int K=5000;
int t[110],f[10010],si,pd2=1,pd=1,f2[10100];
int main(){
sieve();
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
for(int i=1;i<=c;i++){
f[K]=1,si=0;
for(int j=1;j<=n;j++){
t[j]=0;
while(!(a[j]%p[i]))a[j]/=p[i],t[j]++;
if(!t[j])continue;
pd=1ll*pd*((t[j]+2)*(t[j]+1)/2)%mod;
for(int x=K-si;x<=K+si;x++)for(int a=0;a<=t[j];a++)for(int b=0;a+b<=t[j];b++)
(f2[a-b+x]+=f[x])%=mod;
si+=t[j];
for(int x=K-si;x<=K+si;x++)f[x]=f2[x],f2[x]=0;
}
}
for(int i=1;i<=n;i++)if(a[i]>1){
int V=a[i];si=0;f[K]=1;
for(int j=1;j<=n;j++)if(a[j]==V){
a[j]=1;pd=1ll*pd*3%mod;
for(int x=K-si;x<=K+si;x++)for(int a=-1;a<=1;a++)(f2[a+x]+=f[x])%=mod;
si++;
for(int x=K-si;x<=K+si;x++)f[x]=f2[x],f2[x]=0;
}
}
return printf("%d",(1ll*(pd+pd2)*inv2%mod+mod)%mod),0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 17
Accepted
time: 1ms
memory: 3692kb
input:
2 2 3
output:
5
result:
ok single line: '5'
Test #2:
score: -17
Wrong Answer
time: 1ms
memory: 3784kb
input:
4 5 8 8 9
output:
499123077
result:
wrong answer 1st lines differ - expected: '916', found: '499123077'
Subtask #2:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 3916kb
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:
462141989
result:
wrong answer 1st lines differ - expected: '476416688', found: '462141989'
Subtask #3:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 2ms
memory: 3700kb
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:
462141989
result:
wrong answer 1st lines differ - expected: '476416688', found: '462141989'