QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#488843 | #5356. esperar | NianFeng | 0 | 2ms | 10924kb | C++14 | 1.8kb | 2024-07-24 15:42:59 | 2024-07-24 15:43:00 |
Judging History
answer
#include <bits/stdc++.h>
const int mod=998244353;
#define int long long
namespace io{
char buf[1<<21],*p1=buf,*p2=buf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline int read(){
int x=0; bool flag=true; char c=getchar();
while(!isdigit(c)){ if(c=='-') flag=false; c=getchar(); }
while(isdigit(c)){ x=(x<<1)+(x<<3)+(c^48); c=getchar(); }
return flag?x:~(x-1);
}
}
namespace math{
inline int Qpow(int a,int x){
int res=1;
while(x){
if(x&1)
(res*=a)%=mod;
(a*=a)%=mod,x>>=1;
}
return res;
}
}
using namespace math;
using namespace std;
using namespace io;
const int P=35000;
const int M=3000;
const int N=105;
bool is[P];
int prime[P],tot;
void init(){
is[0]=is[1]=true;
for(int i=2;i<P;i++){
if(!is[i])
prime[++tot]=i;
for(int j=1;j<=tot&&i*prime[j]<P;j++){
is[i*prime[j]]=true;
if(i%prime[j]==0) break;
}
}
}
int n,a[N];
int num[N],lm;
int f[N][M*2];
int sum=1,cnt=1;
void dp(int p){
for(int i=1;i<=n;i++){
num[i]=0;
while(a[i]%p==0)
a[i]/=p,num[i]++;
sum=(sum*(num[i]+1)*(num[i]+2)/2)%mod;
}
memset(f,0,sizeof(f));
f[0][M]=1,lm=0;
for(int i=1;i<=n;i++)
for(int j=M-lm;j<=M+lm;j++)
for(int x=0;x<=num[i];x++)
for(int y=0;y+x<=num[i];y++)
f[i][j+x-y]=(f[i][j+x-y]+f[i-1][j])%mod;
cnt=(cnt*f[n][M])%mod;
}
signed main(){
n=read();
for(int i=1;i<=n;i++) a[i]=read();
for(int i=1;i<=tot;i++) dp(prime[i]);
for(int i=1;i<=n;i++)
if(a[i]>1) dp(a[i]);
printf("%lld\n",(sum+cnt)%mod*Qpow(2,mod-2)%mod);
return 0;
}
详细
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 17
Accepted
time: 0ms
memory: 9148kb
input:
2 2 3
output:
5
result:
ok single line: '5'
Test #2:
score: 0
Wrong Answer
time: 2ms
memory: 9236kb
input:
4 5 8 8 9
output:
41
result:
wrong answer 1st lines differ - expected: '916', found: '41'
Subtask #2:
score: 0
Wrong Answer
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 10808kb
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:
596015439
result:
wrong answer 1st lines differ - expected: '476416688', found: '596015439'
Subtask #3:
score: 0
Wrong Answer
Test #12:
score: 0
Wrong Answer
time: 0ms
memory: 10924kb
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:
596015439
result:
wrong answer 1st lines differ - expected: '476416688', found: '596015439'