UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#211415#3804. 小璃的战斗18915523188184ms6184kbC++1.7kb2024-08-11 11:31:282024-08-11 13:07:31

answer

#include <bits/stdc++.h>
#define ll long long
#define M 998244353
#pragma GCC optimeze(2)
using namespace std;

ll n,l,e,c[305],p[10],a[90005],ans=0,b[90005],ccc[90005],cc[90005];
bool bc=true,bp=true;

void ddd(ll k,ll ch,ll an,ll cd,ll nk){
	if(k>nk){
//		cout<<0<<" ";
//		for(int i=1;i<=nk;i++){
//			cout<<b[i]<<" ";
//		}cout<<endl;
//		cout<<0<<" ";
//		for(int i=1;i<=nk;i++){
//			cout<<ccc[i]<<" ";
//		}cout<<endl;
//		cout<<e<<" ";
//		for(int i=1;i<=nk;i++){
//			cout<<cc[i]<<" ";
//		}cout<<endl;
//		cout<<an<<endl;
		ans=(ans+an)%M;
		return;
	}
//	b[k]=0;
//	ccc[k]=cd;
//	cc[k]=min((ll)240,ch+a[k]);
	ddd(k+1,min((ll)240,ch+a[k]),an,cd,nk);
	if(ch>=120&&a[k]!=20){
		if(a[k]){
//			b[k]=1;
//			ccc[k]=cd;
//			cc[k]=ch-115+a[k];
			ddd(k+1,ch-115+a[k],an+1,cd,nk);
		}else if(cd==1){
//			b[k]=1;
//			ccc[k]=0;
//			cc[k]=ch-115+a[k];
			ddd(k+1,ch-115+a[k],an+1,(ll)0,nk);
		}else{
//			b[k]=2;
//			ccc[k]=1;
//			cc[k]=ch-115+a[k];
			ddd(k+1,ch-115+a[k],an,(ll)1,nk);
		}
	}
	return;
}

void dfs(ll k,ll ck,ll ik){
	if(k>n){
//		for(int i=1;i<ik;i++){
//			cout<<a[i]<<" ";
//		}cout<<endl;
		ddd(1,e,0,0,ik-1);
		return;
	}
	if(ck>c[k]){
		a[ik]=20;
		dfs(k+1,1,ik+1);
		return;
	}
	for(int i=1;i<=l;i++){
		a[ik]=p[i];
		dfs(k,ck+1,ik+1);
	}
	return;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    cin>>n;
    for(int i=1;i<=n;i++){
    	cin>>c[i];
    	if(c[i]>4){
    		bc=false;
		}
	}
	cin>>l;
	for(int i=1;i<=l;i++){
		cin>>p[i];
		if(p[i]!=0){
			bp=false;
		}
	}
	cin>>e;
	dfs(1,1,1);
	cout<<ans;
	
	
	
    return 0;
}

详细

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

Test #1:

score: 2
Accepted
time: 0ms
memory: 1256kb

input:

2
2 4
1
25
167

output:

34

result:

ok "34"

Test #2:

score: 2
Accepted
time: 1ms
memory: 1256kb

input:

1
4
2
40 45
223

output:

304

result:

ok "304"

Test #3:

score: 2
Accepted
time: 0ms
memory: 1256kb

input:

2
2 4
2
0 45
161

output:

1159

result:

ok "1159"

Test #4:

score: 2
Accepted
time: 0ms
memory: 1256kb

input:

2
2 1
2
25 35
221

output:

72

result:

ok "72"

Test #5:

score: 2
Accepted
time: 0ms
memory: 1252kb

input:

1
1
1
40
6

output:

0

result:

ok "0"

Test #6:

score: 2
Accepted
time: 0ms
memory: 1252kb

input:

1
4
2
30 25
55

output:

16

result:

ok "16"

Test #7:

score: 2
Accepted
time: 0ms
memory: 1256kb

input:

2
1 4
1
45
161

output:

35

result:

ok "35"

Test #8:

score: 2
Accepted
time: 0ms
memory: 1248kb

input:

1
4
2
0 25
55

output:

1

result:

ok "1"

Test #9:

score: 2
Accepted
time: 0ms
memory: 1248kb

input:

2
2 3
1
0
33

output:

0

result:

ok "0"

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 6176kb

input:

277
605376561 910253890 270922374 265125322 736886507 204360393 143001007 642923206 784883218 695993...

output:

0

result:

wrong answer 1st words differ - expected: '24845283', found: '0'

Test #11:

score: 0
Wrong Answer
time: 0ms
memory: 6176kb

input:

170
202076194 345630086 998085568 788765708 814906822 849504079 803465657 206348014 611944107 968416...

output:

0

result:

wrong answer 1st words differ - expected: '846905405', found: '0'

Test #12:

score: 0
Wrong Answer
time: 0ms
memory: 6180kb

input:

206
551757632 422666542 368785100 39513480 360101767 609597999 532143607 897007896 191082378 9597631...

output:

0

result:

wrong answer 1st words differ - expected: '929614122', found: '0'

Test #13:

score: 0
Wrong Answer
time: 0ms
memory: 6180kb

input:

150
835438994 389440405 775872291 825712716 312687066 137989104 902156563 321463095 644646631 435007...

output:

0

result:

wrong answer 1st words differ - expected: '301853377', found: '0'

Test #14:

score: 0
Wrong Answer
time: 0ms
memory: 6176kb

input:

225
531574213 910194584 655048830 143130111 76538835 123155107 311114315 691976412 266555772 5221147...

output:

0

result:

wrong answer 1st words differ - expected: '123125451', found: '0'

Test #15:

score: 0
Wrong Answer
time: 3ms
memory: 6180kb

input:

241
186651760 198152450 726519229 975856337 536323475 199914159 302294459 28093616 31811668 94929609...

output:

0

result:

wrong answer 1st words differ - expected: '5062380', found: '0'

Test #16:

score: 0
Wrong Answer
time: 0ms
memory: 6176kb

input:

145
825382719 303695251 160033591 558973047 901737205 584232659 221381948 464760435 741550741 207899...

output:

0

result:

wrong answer 1st words differ - expected: '313434151', found: '0'

Test #17:

score: 0
Time Limit Exceeded

input:

236
210 269 265 217 151 268 237 246 244 176 214 168 199 161 263 150 171 152 220 298 240 281 177 180 ...

output:


result:


Test #18:

score: 0
Time Limit Exceeded

input:

204
285 295 187 215 197 200 166 231 291 189 220 193 257 182 176 166 174 258 257 250 286 163 277 251 ...

output:


result:


Test #19:

score: 0
Time Limit Exceeded

input:

279
207 286 174 168 254 272 290 164 250 268 232 212 209 211 207 172 216 279 247 272 161 152 288 159 ...

output:


result:


Test #20:

score: 0
Time Limit Exceeded

input:

232
203 245 215 277 284 227 165 270 167 162 251 197 171 171 218 218 177 286 161 277 208 156 232 256 ...

output:


result:


Test #21:

score: 0
Time Limit Exceeded

input:

246
177 227 271 229 211 242 291 299 245 280 206 276 212 248 271 184 153 228 193 288 261 284 191 248 ...

output:


result:


Test #22:

score: 0
Time Limit Exceeded

input:

218
186 214 206 222 213 270 183 192 206 187 206 262 200 184 182 209 167 240 275 221 174 278 281 235 ...

output:


result:


Test #23:

score: 0
Time Limit Exceeded

input:

203
256 175 253 274 241 254 268 219 264 161 163 274 249 278 215 245 212 295 173 269 222 213 222 236 ...

output:


result:


Test #24:

score: 0
Time Limit Exceeded

input:

297
183 180 260 223 240 273 193 222 207 237 226 286 178 151 208 170 260 284 246 181 243 172 266 236 ...

output:


result:


Test #25:

score: 0
Time Limit Exceeded

input:

215
217 209 191 244 274 188 234 184 252 157 299 258 184 267 153 221 273 184 153 177 256 262 289 175 ...

output:


result:


Test #26:

score: 0
Time Limit Exceeded

input:

295
225 233 208 271 187 236 241 189 219 292 252 168 264 283 233 221 205 167 234 287 243 220 158 175 ...

output:


result:


Test #27:

score: 0
Time Limit Exceeded

input:

299
203 291 213 266 297 203 247 211 247 215 263 197 222 284 279 226 184 225 274 191 189 264 233 239 ...

output:


result:


Test #28:

score: 0
Time Limit Exceeded

input:

282
260 226 253 169 172 246 180 235 158 241 291 265 217 293 200 291 192 150 162 296 234 199 214 241 ...

output:


result:


Test #29:

score: 0
Time Limit Exceeded

input:

253
213 169 271 234 196 242 162 174 279 252 226 278 274 299 275 183 190 251 152 284 172 172 219 282 ...

output:


result:


Test #30:

score: 0
Time Limit Exceeded

input:

244
261 208 209 266 233 251 167 263 257 252 187 287 208 201 195 287 257 156 266 155 300 233 210 297 ...

output:


result:


Test #31:

score: 0
Time Limit Exceeded

input:

4
50744225 38575863 495383008 631106704
4
0 25 35 30
24

output:


result:


Test #32:

score: 0
Time Limit Exceeded

input:

4
673632204 632599294 87647500 259824460
4
40 0 30 45
157

output:


result:


Test #33:

score: 0
Time Limit Exceeded

input:

4
14299465 827073858 503533923 293157764
5
0 25 40 45 35
222

output:


result:


Test #34:

score: 0
Time Limit Exceeded

input:

4
663968026 24024344 854278647 369272663
5
35 0 25 45 40
82

output:


result:


Test #35:

score: 0
Time Limit Exceeded

input:

4
201480655 281570624 460966655 520615378
3
35 0 25
154

output:


result:


Test #36:

score: 0
Time Limit Exceeded

input:

4
102842920 576317606 634020368 916827654
2
0 30
119

output:


result:


Test #37:

score: 0
Time Limit Exceeded

input:

4
370588670 109359792 418934615 796823541
2
25 30
128

output:


result:


Test #38:

score: 0
Time Limit Exceeded

input:

4
531736881 952131467 688585945 313261542
6
40 45 30 35 0 25
78

output:


result:


Test #39:

score: 0
Time Limit Exceeded

input:

4
132751568 59366279 305927515 739539040
3
40 30 45
96

output:


result:


Test #40:

score: 0
Time Limit Exceeded

input:

4
285073926 640307115 356656822 327551729
6
40 25 30 0 45 35
155

output:


result:


Test #41:

score: 0
Wrong Answer
time: 0ms
memory: 6176kb

input:

205
412930570 552629105 672175662 303694806 904807831 507202370 747835207 15071231 859893402 1380360...

output:

0

result:

wrong answer 1st words differ - expected: '304294575', found: '0'

Test #42:

score: 0
Runtime Error

input:

214
19482433 61432329 815160734 369893772 748103097 124250254 326720190 559458458 856249164 98995671...

output:


result:


Test #43:

score: 0
Runtime Error

input:

228
241116086 337844661 777859665 621930050 219124560 288532557 449893014 70007068 78311937 55092074...

output:


result:


Test #44:

score: 0
Wrong Answer
time: 0ms
memory: 6180kb

input:

201
971257189 374045009 944462414 537953285 782273469 508697813 853375962 907670430 857179519 919125...

output:

0

result:

wrong answer 1st words differ - expected: '360149789', found: '0'

Test #45:

score: 0
Wrong Answer
time: 0ms
memory: 6180kb

input:

242
41370261 713342743 734488650 964341025 444683786 352744376 520404685 481078811 240751328 3936243...

output:

0

result:

wrong answer 1st words differ - expected: '710054996', found: '0'

Test #46:

score: 0
Runtime Error

input:

212
460585228 988049100 554627029 805469349 677495536 196685890 50640467 688159933 87204763 63772004...

output:


result:


Test #47:

score: 0
Wrong Answer
time: 0ms
memory: 6176kb

input:

264
144360415 304243545 861675592 116241251 61636172 671870370 967871925 500422194 63828918 53413669...

output:

0

result:

wrong answer 1st words differ - expected: '250936879', found: '0'

Test #48:

score: 0
Runtime Error

input:

292
884038219 292746082 444330474 653054716 823793789 883470573 289247597 937444397 512144383 736086...

output:


result:


Test #49:

score: 0
Runtime Error

input:

277
524512852 625493914 894422617 887636172 738205289 547388902 688301140 338861248 972926334 310518...

output:


result:


Test #50:

score: 0
Wrong Answer
time: 0ms
memory: 6184kb

input:

300
536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870911 536870...

output:

0

result:

wrong answer 1st words differ - expected: '87568788', found: '0'