UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#184665#2052. 子序列gispzjz10058ms1400kbC++11529b2023-09-09 15:09:082023-09-09 15:09:09

answer

#include <cstdio>
#include <cstring>

const int p=998244353;
const int inv_100=828542813;
int d[30],f[120000],g[120000];
char c[120000];
int i,j,n,r,s,t;

int main()
{
	scanf("%d",&n);
	scanf("%s",c+1);
	for (i=1;i<=n;i++)
	{
		scanf("%d",&g[i]);
		g[i]=1LL*(100-g[i])*inv_100%p;
	}
	s=1;
	f[0]=1;
	for (i=1;i<=26;i++)
		d[i]=1;
	for (i=1;i<=n;i++)
	{
		f[i]=1LL*d[c[i]-96]*g[i]%p;
		for (j=1;j<=26;j++)
			if (j!=c[i]-96)
				d[j]=(d[j]+f[i])%p;
		s=(s+f[i])%p;
	}
	printf("%d",s);
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 520kb

input:

10
baabbababa
32 84 50 72 73 80 51 16 27 38

output:

931164467

result:

ok single line: '931164467'

Test #2:

score: 10
Accepted
time: 0ms
memory: 520kb

input:

10
aabbbabaaa
79 10 1 51 54 84 75 61 5 20

output:

199251909

result:

ok single line: '199251909'

Test #3:

score: 10
Accepted
time: 0ms
memory: 516kb

input:

10
baabaabbaa
78 49 45 16 16 79 21 99 61 49

output:

522228342

result:

ok single line: '522228342'

Test #4:

score: 10
Accepted
time: 0ms
memory: 532kb

input:

1000
dabdbedccdebcdbbebdcaeedebdbccdaabebdecbeebbebedecebacdcabdbeaebcbdeceaaebddceadbbaaebeedccedea...

output:

825347577

result:

ok single line: '825347577'

Test #5:

score: 10
Accepted
time: 0ms
memory: 532kb

input:

1000
dababaebbeaedccabebabcecebebaeebeedbebbddbebccceebbdbccbedeecddabebcedadbecbadcedebbccaaeadccaa...

output:

298152289

result:

ok single line: '298152289'

Test #6:

score: 10
Accepted
time: 14ms
memory: 1400kb

input:

100000
bbgejihfhafdeacedbbgiaafecgidaeiggbbjfhiaaheaijghhbifcjcdhadcdedjdejijbeihgfjafeiaehhfigjgaig...

output:

614248473

result:

ok single line: '614248473'

Test #7:

score: 10
Accepted
time: 14ms
memory: 1400kb

input:

100000
ieefgijddfhhbgfedegdddaijafgicijgcahijggbehbbihdhfeiacjfehjjeeebeaheiadhddeafcbcehahbieeihdag...

output:

299542715

result:

ok single line: '299542715'

Test #8:

score: 10
Accepted
time: 14ms
memory: 1400kb

input:

100000
ebfabaffebgjjajbacjdjhhgbgehagjhihbjidhdcgjcbghegbabjbecjgjfcjjeijbfjdddfjeajjffabijfaggdjhcf...

output:

689835121

result:

ok single line: '689835121'

Test #9:

score: 10
Accepted
time: 7ms
memory: 1400kb

input:

100000
jifjcebdgjjjfcafdceiehfgfciechchcebbjijbdcbhhejdcieebbhfabbjghhjgfaafgbbgbcicjgcfdfbjicagcffg...

output:

448080023

result:

ok single line: '448080023'

Test #10:

score: 10
Accepted
time: 9ms
memory: 1396kb

input:

100000
agjjjcibcbcaajegcihcidbbagjgjdajajffgjjihjfjgijadgjjifcfciihchdiefihbidihcheecccbjdcagecdjhif...

output:

245353070

result:

ok single line: '245353070'