UOJ Logo

NOI.AC

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#215340#2162. 无限手套fddwd303490ms1284kbC++11567b2024-11-28 19:29:002024-11-28 23:11:00

answer

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mod 998244353
int m,n,q;
ll a[1010],b[1010],dp[10010];
inline ll cal(int id,int num){
	return (a[id]*num%mod*num%mod+b[id]*num%mod+1)%mod;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>m;for(int i=1;i<=m;++i) cin>>a[i]>>b[i];
	dp[0]=1;n=min(10000,(int)sqrt(5e7/m));
	for(int i=1;i<=m;++i){
		for(int j=n;~j;--j)
		for(int k=1;k<=j;++k)
			(dp[j]+=dp[j-k]*cal(i,k))%=mod;
	}cin>>q;
	while(q--){
		cin>>n;
		cout<<dp[n]<<endl;
	}
	return 0;
}

Details

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

Test #1:

score: 5
Accepted
time: 172ms
memory: 1284kb

input:

10
21 59
15 27
62 71
100 98
88 16
62 25
88 66
72 71
29 31
1 0
10
2
2
3
2
4
5
8
5
6
5

output:

448551
448551
114612322
448551
728853470
277267547
83320298
277267547
38592888
277267547

result:

ok 10 lines

Test #2:

score: 5
Accepted
time: 172ms
memory: 1276kb

input:

17
73 29
79 15
100 35
34 97
39 50
3 48
45 68
47 50
3 28
73 85
89 87
55 46
14 54
49 88
42 73
44 2
16 ...

output:

114883454
27471359
887593781
827351165
86981973
827351165
1392510
114883454
1725
421716985
307599961...

result:

ok 17 lines

Test #3:

score: 5
Accepted
time: 172ms
memory: 1276kb

input:

20
27 19
18 92
81 51
63 60
32 34
51 84
33 42
74 60
77 36
6 21
24 17
75 92
31 53
31 80
8 30
79 26
83 ...

output:

992068581
1969
892548909
238165372
110008477
995194659
179471275
420889444
11928868
179471275
272422...

result:

ok 20 lines

Test #4:

score: 5
Accepted
time: 172ms
memory: 1276kb

input:

25
26 7
38 93
23 54
7 73
19 76
82 2
56 27
97 81
54 28
54 21
62 43
34 40
60 53
15 36
70 16
69 66
63 8...

output:

103269
734406478
345903674
359420380
880946160
271579155
32581827
880946160
966935950
611559579
4653...

result:

ok 25 lines

Test #5:

score: 5
Accepted
time: 172ms
memory: 1276kb

input:

27
80 18
40 71
21 78
53 67
24 18
97 21
56 24
10 32
36 17
48 23
45 44
77 94
93 11
35 32
52 57
73 51
6...

output:

410943243
721573301
181533076
668067998
682080677
863525129
63084931
705139901
452302283
245889941
1...

result:

ok 27 lines

Test #6:

score: 5
Accepted
time: 168ms
memory: 1272kb

input:

30
42 32
4 11
64 52
52 45
8 29
27 81
57 52
51 42
52 85
27 61
69 46
18 43
69 87
77 92
5 23
69 15
21 8...

output:

810744230
839400864
924094824
937834219
316524152
529862398
712976747
219997060
272438710
519978575
...

result:

ok 30 lines

Test #7:

score: 0
Wrong Answer
time: 175ms
memory: 1276kb

input:

500
35 33
42 54
68 92
11 31
78 89
89 33
12 43
40 25
89 74
10 96
72 79
41 27
26 9
89 3
24 32
90 22
86...

output:

0
0
0
0
0
0
0
0
0
783110232
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
583809594
346830754
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '932312156', found: '0'

Test #8:

score: 0
Wrong Answer
time: 177ms
memory: 1280kb

input:

800
67 2
17 90
7 2
80 77
15 8
96 71
77 85
67 83
30 67
21 37
95 0
1 70
69 83
8 28
42 80
32 99
35 13
8...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
131800799
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '819268178', found: '0'

Test #9:

score: 0
Wrong Answer
time: 177ms
memory: 1276kb

input:

1000
117036880 742743701
56908371 507994295
14078772 65839630
907546488 34355343
620471543 368910184...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
403881588
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '461522957', found: '0'

Test #10:

score: 0
Wrong Answer
time: 174ms
memory: 1276kb

input:

1000
913953750 388577668
962198313 857512157
801529469 683598255
815720687 278538934
837931460 95491...

output:

0
0
0
0
0
0
0
0
0
0
599967938
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '612389072', found: '0'

Test #11:

score: 0
Wrong Answer
time: 175ms
memory: 1280kb

input:

1000
686221334 956155197
638206740 299677636
12110365 985957201
296066012 395725665
135750350 202076...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
109238763
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '616161259', found: '0'

Test #12:

score: 0
Wrong Answer
time: 178ms
memory: 1280kb

input:

1000
797564334 746000325
114543902 483936681
721653706 427330786
783028161 561100881
560205639 93358...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
543387681
0
0
0
324310331
0
0
...

result:

wrong answer 1st lines differ - expected: '387718885', found: '0'

Test #13:

score: 0
Wrong Answer
time: 176ms
memory: 1276kb

input:

1000
839212319 281284893
986615727 337004261
337283416 832217943
139479834 143482354
718642613 79109...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
621480525
0
0
0
0
0
0
244491175
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '709654221', found: '0'

Test #14:

score: 0
Wrong Answer
time: 171ms
memory: 1280kb

input:

1000
256682454 224905163
546469163 405500779
694909527 452737645
118757654 446812736
305219239 49932...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
103425883
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '361868779', found: '0'

Test #15:

score: 0
Wrong Answer
time: 178ms
memory: 1276kb

input:

1000
896922349 6803764
761865535 943048070
88880191 606683203
70560593 543433355
840830392 692058868...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
623768266
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '758319401', found: '0'

Test #16:

score: 0
Wrong Answer
time: 174ms
memory: 1280kb

input:

1000
449301829 90031054
325997406 72341047
30416088 913003710
735565029 221233542
491751571 62166318...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '259182799', found: '0'

Test #17:

score: 0
Wrong Answer
time: 181ms
memory: 1276kb

input:

1000
832954961 166377984
853572866 869031810
703004519 916522551
674441360 532019428
604496 80785481...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
90226857
0
0
0
0
0
0
0...

result:

wrong answer 1st lines differ - expected: '121395962', found: '0'

Test #18:

score: 0
Wrong Answer
time: 174ms
memory: 1276kb

input:

1000
630591319 431364812
551848923 931390133
383831685 842422164
638941693 967379955
11797927 362876...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
662000256
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '497539048', found: '0'

Test #19:

score: 0
Wrong Answer
time: 174ms
memory: 1280kb

input:

1000
787106265 727082581
227535146 533287459
837875354 738523208
652170865 583327908
506011496 84943...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
757757948
0
0
0
386198487
0
0
0
...

result:

wrong answer 1st lines differ - expected: '428205973', found: '0'

Test #20:

score: 0
Wrong Answer
time: 178ms
memory: 1280kb

input:

1000
756021044 519638624
79079358 955991362
303396062 299442290
396653454 370013814
118684193 153986...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st lines differ - expected: '132509106', found: '0'