QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#75531 | #5356. esperar | xlwang | 17 | 2ms | 3580kb | C++14 | 2.7kb | 2023-02-05 16:36:35 | 2023-02-05 16:36:35 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define fr(i,j,k) for(register int i=j;i<=k;++i)
#define rf(i,j,k) for(register int i=j;i>=k;--i)
#define foredge(i,j) for(register int i=head[j];i;i=e[i].nxt)
#define randfind(l,r) (rand()%((r)-(l)+1)+(l))
#define pb push_back
#define Times printf("Time:%.3lf\n",clock()/CLOCKS_PER_SEC)
using namespace std;
inline int read(){
int x=0;
bool f=0;
char c=getchar();
while(!isdigit(c)) f|=(c=='-'),c=getchar();
while(isdigit(c)) x=(x<<3)+(x<<1)+(c^48),c=getchar();
return f?-x:x;
}
inline void write(int x){
if(x<0){putchar('-');x=-x;}
if(x>9)write(x/10);
putchar(x%10+'0');
}
inline void writeln(int x){write(x); puts("");}
inline void writepl(int x){write(x); putchar(' ');}
//inline void init(){
// int t=read();
// while(t--) work();
//}
const int Maxn=1e2+10,mod=998244353;
vector<int> vc[Maxn];
int a[Maxn];
int n;
map<int,int> mp;
int cnt;
inline void init(){
n=read();
fr(i,1,n) a[i]=read();
}
int ans1=1;
inline void add(int x,int id){
for(register int i=2;i*i<=x;++i){
if(x%i!=0) continue;
if(!mp[i]) mp[i]=++cnt;
int tot;
tot=mp[i];
int pop=0;
while(x%i==0) ++pop,x/=i;
ans1*=((pop+2)*(pop+1)/2)%mod;ans1%=mod;
vc[tot].push_back(pop);
}
if(x!=1){
if(!mp[x]) mp[x]=++cnt;
int tot=mp[x];
ans1*=3,ans1%=mod;
vc[tot].push_back(1);
}
}
int f[1010],g[1010],g1[1010];
int ans2=1,nowsum;
inline int getsum(int x){return nowsum+x;}
inline void into(int x){
vector<int> now;
now=vc[x];
for(register int i=0;i<now.size();++i) nowsum+=now[i];
memset(f,0,sizeof(f));
f[getsum(0)]=1;
int tot=0;
for(register int i=0;i<now.size();++i){
// memset(g,0,sizeof(g));
int x=now[i];
fr(i1,0,x) fr(i2,0,i1) g1[getsum(2*i2-i1)]++;
fr(j,-tot,tot) fr(k,-x,x) g[getsum(j+k)]+=f[getsum(j)]*g1[getsum(k)],g[getsum(j+k)]%=mod;
fr(j,-x,x) g1[getsum(j)]=0;
tot+=x;
fr(j,-tot,tot) f[getsum(j)]=g[getsum(j)],g[getsum(j)]=0;
}
ans2*=f[getsum(0)],ans2%=mod;
}
inline int ksm(int x,int y){
int sum=1;
while(y){
if(y&1) sum=sum*x%mod;
x=x*x%mod;
y=y/2;
}
return sum;
}
inline void work(){
fr(i,1,n) add(a[i],i);
fr(i,1,cnt) into(i);
// writepl(ans1),writeln(ans2);
// writeln(ksm(2,mod-2));
writeln((ans1+ans2)*ksm(2,mod-2)%mod);
}
signed main(){
// freopen("input.in","r",stdin);
// freopen("output.out","w",stdout);
init();work();
// printf("\nTIME:%.3lf",(double)clock()/CLOCKS_PER_SEC);
return 0;
}
詳細信息
Subtask #1:
score: 17
Accepted
Test #1:
score: 17
Accepted
time: 2ms
memory: 3332kb
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: 2ms
memory: 3580kb
input:
5 4 8 7 4 10
output:
4939
result:
ok single line: '4939'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3576kb
input:
5 2 7 7 10 10
output:
1125
result:
ok single line: '1125'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3440kb
input:
4 5 5 4 3
output:
84
result:
ok single line: '84'
Test #6:
score: 0
Accepted
time: 2ms
memory: 3396kb
input:
4 5 5 6 4
output:
249
result:
ok single line: '249'
Subtask #2:
score: 0
Runtime Error
Test #7:
score: 0
Runtime Error
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:
result:
Subtask #3:
score: 0
Runtime Error
Test #12:
score: 0
Runtime Error
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...