QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#75532 | #5356. esperar | xlwang | 100 ✓ | 23ms | 8844kb | C++14 | 2.7kb | 2023-02-05 16:37:32 | 2023-02-05 16:37: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=1e5+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[Maxn],g[Maxn],g1[Maxn];
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;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 17
Accepted
Test #1:
score: 17
Accepted
time: 3ms
memory: 7744kb
input:
2 2 3
output:
5
result:
ok single line: '5'
Test #2:
score: 0
Accepted
time: 4ms
memory: 7640kb
input:
4 5 8 8 9
output:
916
result:
ok single line: '916'
Test #3:
score: 0
Accepted
time: 0ms
memory: 8472kb
input:
5 4 8 7 4 10
output:
4939
result:
ok single line: '4939'
Test #4:
score: 0
Accepted
time: 1ms
memory: 8844kb
input:
5 2 7 7 10 10
output:
1125
result:
ok single line: '1125'
Test #5:
score: 0
Accepted
time: 1ms
memory: 7872kb
input:
4 5 5 4 3
output:
84
result:
ok single line: '84'
Test #6:
score: 0
Accepted
time: 2ms
memory: 8012kb
input:
4 5 5 6 4
output:
249
result:
ok single line: '249'
Subtask #2:
score: 32
Accepted
Test #7:
score: 32
Accepted
time: 0ms
memory: 8044kb
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: 3ms
memory: 7296kb
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: 3ms
memory: 8708kb
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: 2ms
memory: 8252kb
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: 3ms
memory: 7332kb
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: 51
Accepted
Test #12:
score: 51
Accepted
time: 0ms
memory: 8804kb
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: 6ms
memory: 7348kb
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: 2ms
memory: 8472kb
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: 5ms
memory: 7260kb
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: 2ms
memory: 7296kb
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: 0
Accepted
time: 12ms
memory: 8528kb
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:
7638211
result:
ok single line: '7638211'
Test #18:
score: 0
Accepted
time: 11ms
memory: 7632kb
input:
100 958881349 171519718 864234728 557119142 512605162 183590393 470824223 970575734 110156535 401554720 770813102 947815994 649534146 829550429 38409642 44406471 58904773 780328694 35877265 35975542 917349149 892726263 917467585 492653986 493744908 451455661 729885182 65571373 783406967 746795564 58...
output:
312661411
result:
ok single line: '312661411'
Test #19:
score: 0
Accepted
time: 11ms
memory: 7800kb
input:
100 959502896 462545634 744655088 95269387 537668562 154525442 528529645 38771667 14060238 761488508 867702659 678636194 299376115 724005251 855620977 560648236 650357648 44955115 366345272 936232200 754298873 428412848 327449760 68607794 263488520 753107310 442461491 210169993 74552217 332169446 80...
output:
575390588
result:
ok single line: '575390588'
Test #20:
score: 0
Accepted
time: 23ms
memory: 7516kb
input:
100 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870912 536870...
output:
372795835
result:
ok single line: '372795835'
Test #21:
score: 0
Accepted
time: 7ms
memory: 7640kb
input:
100 573308928 725594112 805306368 516560652 603979776 612220032 544195584 905969664 774840978 859963392 774840978 805306368 688747536 509607936 805306368 774840978 573308928 612220032 544195584 644972544 509607936 603979776 816293376 603979776 774840978 644972544 918330048 516560652 774840978 573308...
output:
814735903
result:
ok single line: '814735903'
Test #22:
score: 0
Accepted
time: 4ms
memory: 8300kb
input:
100 81861840 585002088 120759120 636884640 909803664 19688832 761060448 681504192 279656064 920854656 901642752 728776440 246063744 62393652 380380032 480066912 853701768 550027584 293069664 109857384 486248832 743305248 795074832 565085808 67557888 724738752 852825024 523964376 493588404 632375856 ...
output:
570620159
result:
ok single line: '570620159'
Test #23:
score: 0
Accepted
time: 6ms
memory: 7584kb
input:
100 837803736 685473840 632445408 370054656 410992704 978446304 16796160 832586688 597383424 973026432 724124448 120103776 828618336 863619840 447768000 482049792 699787512 270674784 384538752 189921024 322544808 904142592 591084864 17032896 432594432 107380080 622707264 268900128 329671296 14122771...
output:
393692080
result:
ok single line: '393692080'
Test #24:
score: 0
Accepted
time: 5ms
memory: 7376kb
input:
100 993819456 738762768 964076256 447547680 818112960 954443136 350127360 363075534 520540992 833797152 558674496 891531360 915717312 323664336 712580976 852284592 185425200 190144584 710263728 856977408 512435484 826219008 770415840 212682240 496622016 103716288 401978862 935642340 697553856 341381...
output:
379630091
result:
ok single line: '379630091'
Test #25:
score: 0
Accepted
time: 2ms
memory: 7560kb
input:
100 354492288 193418280 301938192 669443616 580928976 13996800 343790352 814027968 861285312 445448160 508744152 935258544 489888000 1003104 938345472 100887552 549554544 608387616 181740672 211491648 906900624 923007312 425528640 419580324 760142880 176569632 156125232 1492992 917350272 100338912 1...
output:
918131284
result:
ok single line: '918131284'