QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#227560#5356. esperarxyz12349 51ms38832kbC++141.8kb2023-10-27 18:31:402023-10-27 18:31:41

Judging History

你现在查看的是最新测评结果

  • [2023-10-27 18:31:41]
  • 评测
  • 测评结果:49
  • 用时:51ms
  • 内存:38832kb
  • [2023-10-27 18:31:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const long long mod=998244353;
long long pow_(long long qq,long long ww){long long ee=1;while(ww){if(ww&1) ee*=qq,ee%=mod;qq*=qq,qq%=mod,ww>>=1;}return ee%mod;}
long long a,b,d[1000001],cnt,st[1000001],dp[101][10001],lim=5000,iv2,an;
map<long long,long long> ve;
vector<long long> qu[1000001];
int main()
{
    scanf("%lld",&a);
    for(int i=1;i<=a;i++) scanf("%lld",&d[i]);
    for(int i=1;i<=a;i++)
    {
        for(int j=2;j<=40000;j++)
        {
            if(d[i]%j==0)
            {
                long long hh=0;
                if(!ve[j]) ve[j]=++cnt;
                while(d[i]%j==0) ++hh,d[i]/=j;
                qu[ve[j]].push_back(hh);
            }
        }
        if(d[i]>1)
        {
            if(!ve[d[i]]) ve[d[i]]=++cnt;
            qu[ve[d[i]]].push_back(1);
        }
    }an=1;iv2=pow_(2,mod-2);
    for(int i=1;i<=cnt;i++)
    {
        for(int j=0;j<qu[i].size();j++)
        {
            an=an*(qu[i][j]+1)%mod*(qu[i][j]+2)%mod*iv2%mod;
        }
    }
    long long hh=1;
    for(int i=1;i<=cnt;i++)
    {
        long long cn=qu[i].size(),smm=0;
        dp[0][lim]=1;
        for(int j=0;j<cn;j++)
        {
            long long tt=qu[i][j];smm+=tt;
            for(int k=lim-smm;k<=lim+smm;k++) dp[j+1][k]=0;
            for(int k=lim-smm;k<=lim+smm;k++)
            {
                for(int k1=0;k1<=tt;k1++)
                {
                    for(int k2=0;k2+k1<=tt;k2++)
                    {
                        if(k1-k2+k>=lim-smm&&k1-k2+k<=lim+smm) dp[j+1][k]=(dp[j+1][k]+dp[j][k1-k2+k])%mod;
                    }
                }
            }
        }
        long long sm=0;
        sm=(sm+dp[cn][lim])%mod;
        hh=hh*sm%mod;
    }
    an=(an+hh)%mod;
    printf("%lld",(an*iv2%mod+mod)%mod);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 17
Accepted

Test #1:

score: 17
Accepted
time: 0ms
memory: 31500kb

input:

2
2 3

output:

5

result:

ok single line: '5'

Test #2:

score: 0
Accepted
time: 3ms
memory: 31052kb

input:

4
5 8 8 9

output:

916

result:

ok single line: '916'

Test #3:

score: 0
Accepted
time: 0ms
memory: 30308kb

input:

5
4 8 7 4 10

output:

4939

result:

ok single line: '4939'

Test #4:

score: 0
Accepted
time: 0ms
memory: 31432kb

input:

5
2 7 7 10 10

output:

1125

result:

ok single line: '1125'

Test #5:

score: 0
Accepted
time: 7ms
memory: 31020kb

input:

4
5 5 4 3

output:

84

result:

ok single line: '84'

Test #6:

score: 0
Accepted
time: 5ms
memory: 30472kb

input:

4
5 5 6 4

output:

249

result:

ok single line: '249'

Subtask #2:

score: 32
Accepted

Test #7:

score: 32
Accepted
time: 23ms
memory: 36588kb

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:

476416688

result:

ok single line: '476416688'

Test #8:

score: 0
Accepted
time: 46ms
memory: 38832kb

input:

100
19683 43046721 3 81 43046721 531441 1594323 177147 3 1594323 387420489 81 6561 9 3 14348907 9 59049 3 129140163 2187 1 2187 729 19683 4782969 4782969 387420489 59049 531441 4782969 2187 19683 387420489 387420489 1594323 387420489 59049 9 43046721 1594323 14348907 1 2187 1 27 387420489 1594323 14...

output:

680607930

result:

ok single line: '680607930'

Test #9:

score: 0
Accepted
time: 51ms
memory: 37068kb

input:

100
2187 531441 729 129140163 129140163 729 14348907 27 19683 2187 387420489 243 729 129140163 3 1 531441 59049 4782969 387420489 3 387420489 531441 2187 27 43046721 59049 14348907 43046721 129140163 4782969 43046721 59049 43046721 9 243 6561 129140163 14348907 129140163 1594323 81 129140163 177147 ...

output:

791036287

result:

ok single line: '791036287'

Test #10:

score: 0
Accepted
time: 30ms
memory: 38472kb

input:

100
3 14348907 2187 81 243 1 729 1594323 9 3 9 19683 81 177147 387420489 531441 6561 243 3 81 243 387420489 129140163 14348907 9 243 6561 6561 43046721 27 3 729 387420489 177147 14348907 1 27 81 2187 129140163 4782969 531441 243 81 6561 81 6561 6561 129140163 81 9 729 14348907 177147 2187 2187 9 729...

output:

301961884

result:

ok single line: '301961884'

Test #11:

score: 0
Accepted
time: 18ms
memory: 37196kb

input:

100
3125 3125 15625 78125 15625 125 1 625 25 1 5 48828125 5 1 125 15625 1 48828125 1 3125 25 48828125 244140625 15625 244140625 625 78125 48828125 1 1953125 48828125 125 48828125 48828125 25 390625 78125 3125 25 9765625 3125 5 78125 5 1953125 9765625 3125 390625 390625 9765625 244140625 48828125 25 ...

output:

293129734

result:

ok single line: '293129734'

Subtask #3:

score: 0
Wrong Answer

Test #12:

score: 51
Accepted
time: 21ms
memory: 37092kb

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:

476416688

result:

ok single line: '476416688'

Test #13:

score: 0
Accepted
time: 51ms
memory: 38300kb

input:

100
19683 43046721 3 81 43046721 531441 1594323 177147 3 1594323 387420489 81 6561 9 3 14348907 9 59049 3 129140163 2187 1 2187 729 19683 4782969 4782969 387420489 59049 531441 4782969 2187 19683 387420489 387420489 1594323 387420489 59049 9 43046721 1594323 14348907 1 2187 1 27 387420489 1594323 14...

output:

680607930

result:

ok single line: '680607930'

Test #14:

score: 0
Accepted
time: 48ms
memory: 38488kb

input:

100
2187 531441 729 129140163 129140163 729 14348907 27 19683 2187 387420489 243 729 129140163 3 1 531441 59049 4782969 387420489 3 387420489 531441 2187 27 43046721 59049 14348907 43046721 129140163 4782969 43046721 59049 43046721 9 243 6561 129140163 14348907 129140163 1594323 81 129140163 177147 ...

output:

791036287

result:

ok single line: '791036287'

Test #15:

score: 0
Accepted
time: 37ms
memory: 38660kb

input:

100
3 14348907 2187 81 243 1 729 1594323 9 3 9 19683 81 177147 387420489 531441 6561 243 3 81 243 387420489 129140163 14348907 9 243 6561 6561 43046721 27 3 729 387420489 177147 14348907 1 27 81 2187 129140163 4782969 531441 243 81 6561 81 6561 6561 129140163 81 9 729 14348907 177147 2187 2187 9 729...

output:

301961884

result:

ok single line: '301961884'

Test #16:

score: 0
Accepted
time: 19ms
memory: 37124kb

input:

100
3125 3125 15625 78125 15625 125 1 625 25 1 5 48828125 5 1 125 15625 1 48828125 1 3125 25 48828125 244140625 15625 244140625 625 78125 48828125 1 1953125 48828125 125 48828125 48828125 25 390625 78125 3125 25 9765625 3125 5 78125 5 1953125 9765625 3125 390625 390625 9765625 244140625 48828125 25 ...

output:

293129734

result:

ok single line: '293129734'

Test #17:

score: -51
Wrong Answer
time: 15ms
memory: 34720kb

input:

100
958554192 562894056 924024548 251107572 36911606 198139253 441971512 936445000 695042827 221555058 722401091 545534982 287742250 882290250 56062151 749398293 836903776 111144571 833788733 659556268 998890671 588012058 138718289 204660698 608856718 837533517 873613411 419546623 64076134 417204943...

output:

593187653

result:

wrong answer 1st lines differ - expected: '7638211', found: '593187653'