QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#301660 | #5475. Make a Loop | wxhtzdy | WA | 4ms | 2348kb | C++20 | 535b | 2024-01-10 04:11:02 | 2024-01-10 04:11:03 |
Judging History
answer
#include <stdio.h>
signed char min(signed char a, signed char b) { return a < b ? a : b; }
int s,j;
short int a[101],n,i;
signed char dp[2][500005];
int main(){
scanf("%hd",&n);
s=0;
for(i=1;i<=n;i++) scanf("%hd",&a[i]),s+=a[i];
dp[0][0]=1;
int ns=0;
for(i=1;i<=n;i++){
ns+=a[i];
if(ns>s/2) ns=s/2;
for(j=ns;j>=a[i];j--){
dp[0][j]=(dp[0][j]+dp[1][j-a[i]])&7;
dp[1][j]=(dp[1][j]+dp[0][j-a[i]])&7;
}
}
if(n%2==0&&s%2==0&&dp[0][s/2]>=4) printf("Yes\n"); else printf("No\n");
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 1516kb
input:
4 1 1 1 1
output:
Yes
result:
ok single line: 'Yes'
Test #2:
score: 0
Accepted
time: 0ms
memory: 1464kb
input:
6 1 3 1 3 1 3
output:
Yes
result:
ok single line: 'Yes'
Test #3:
score: 0
Accepted
time: 0ms
memory: 1468kb
input:
6 2 2 1 1 1 1
output:
No
result:
ok single line: 'No'
Test #4:
score: 0
Accepted
time: 0ms
memory: 1560kb
input:
8 99 98 15 10 10 5 2 1
output:
Yes
result:
ok single line: 'Yes'
Test #5:
score: 0
Accepted
time: 3ms
memory: 2280kb
input:
100 9384 9699 9434 9482 9525 39 26 9314 9610 9698 79 9558 9398 9358 9389 52 9395 286 9401 9449 9511 219 9291 9 9384 117 9344 98 9341 32 9375 8893 9414 9434 9412 9699 370 9363 9458 9639 9517 9347 9427 9357 9688 9456 9394 9455 9818 9436 9436 9228 9372 9345 9746 9540 9404 9475 9482 9535 9404 9400 28 91...
output:
No
result:
ok single line: 'No'
Test #6:
score: 0
Accepted
time: 3ms
memory: 2348kb
input:
100 9398 9394 9457 9626 9490 104 9431 9403 9440 9360 9429 9483 9400 9371 9377 9275 9448 9491 9445 9408 9401 59 129 9396 9877 9241 9439 707 9454 9717 9484 9407 9472 9483 47 83 9535 9289 9509 243 9365 132 9352 9496 9571 9439 9365 9456 9924 9479 28 227 17 9358 9494 9311 9342 9300 9434 9731 9886 9654 94...
output:
Yes
result:
ok single line: 'Yes'
Test #7:
score: 0
Accepted
time: 0ms
memory: 2168kb
input:
100 9624 9591 9595 9576 9924 131 9603 9597 9572 9585 9832 107 9611 9839 9055 9462 69 36 9415 9568 9575 9588 9605 21 28 5 9587 9645 594 9586 618 9563 9598 9545 9585 56 9577 9600 135 9627 9540 9599 9672 9989 9537 38 9546 9586 9585 9335 9546 9586 12 9574 9622 157 9927 9535 9200 9602 9585 9368 45 9265 6...
output:
No
result:
ok single line: 'No'
Test #8:
score: 0
Accepted
time: 3ms
memory: 2208kb
input:
100 128 9316 9406 9544 9400 9450 9410 113 9454 8944 9427 9361 271 9427 9425 9415 9425 9312 9211 9539 9819 9445 97 9415 189 9443 9393 14 9570 9467 9429 9319 9458 9507 8746 9119 9425 9474 9268 9493 215 9648 57 199 9234 9045 88 9321 9424 176 9464 9362 9457 9434 9471 9463 9482 102 9408 9333 9611 9429 18...
output:
Yes
result:
ok single line: 'Yes'
Test #9:
score: 0
Accepted
time: 0ms
memory: 2268kb
input:
100 9463 9505 9565 9478 9560 9859 9369 9540 9594 9628 299 9953 9608 9575 152 9542 109 9602 40 9459 9765 9511 9608 9483 9498 9486 9501 9566 9593 40 9567 9518 9550 9611 9570 9569 9538 9881 35 9595 9648 9607 208 9885 9525 9796 9158 9515 9527 9542 9561 9074 9653 9550 9390 9815 9529 9425 156 9460 9613 41...
output:
No
result:
ok single line: 'No'
Test #10:
score: 0
Accepted
time: 4ms
memory: 2316kb
input:
100 9495 9516 9389 9446 9488 9480 9743 9405 9750 9671 9540 9526 6 9516 9560 223 9369 160 9217 9639 9803 9477 9325 342 30 9497 63 9516 9540 9389 9489 9494 9469 9297 9554 9180 144 9418 9448 9504 9379 9584 9581 9557 8580 9786 9339 82 9516 260 9491 9499 32 9516 9525 13 9521 13 9539 44 9659 9533 9465 946...
output:
Yes
result:
ok single line: 'Yes'
Test #11:
score: 0
Accepted
time: 3ms
memory: 2232kb
input:
100 9519 31 9538 9419 9341 18 9479 248 9462 139 27 9375 9383 9440 78 9713 99 8996 9580 9326 183 9422 9432 9421 9055 9425 48 9403 9421 9485 9532 9404 9495 452 8928 9446 13 9426 9305 62 9466 65 198 9313 9355 9127 43 9416 30 202 9473 80 9385 9477 99 9738 9628 9443 9206 87 9432 9421 9372 9295 51 9386 93...
output:
No
result:
ok single line: 'No'
Test #12:
score: 0
Accepted
time: 0ms
memory: 2292kb
input:
100 29 9664 11 9439 9514 9471 9477 9649 60 14 9441 9486 93 9579 9431 9479 12 9425 9431 9374 9129 21 68 9364 9166 9487 9298 9446 743 9435 9440 9743 9373 9368 9777 9551 9466 9220 9443 9443 9420 9430 9437 9440 9650 274 9439 9391 9284 9638 9442 9633 9459 9395 9748 9382 22 9329 58 9466 9591 9439 87 9470 ...
output:
Yes
result:
ok single line: 'Yes'
Test #13:
score: 0
Accepted
time: 3ms
memory: 2260kb
input:
100 333 9362 37 9366 9546 9418 9414 9362 9490 18 402 328 9439 221 9445 9474 9400 21 9479 9648 9438 9455 9473 62 9535 9352 40 9570 9476 527 170 9688 9780 9453 9460 9702 6 9500 9496 9490 9595 9490 9429 9203 9491 9446 65 11 32 9179 9465 184 238 9460 9976 9490 9394 9436 9544 9441 9438 9454 9387 62 9472 ...
output:
No
result:
ok single line: 'No'
Test #14:
score: -100
Wrong Answer
time: 3ms
memory: 2316kb
input:
100 9305 9334 9338 9010 9479 131 9421 9319 9339 9311 9522 9138 9597 9415 9310 9013 9314 16 9032 9270 9436 9594 9316 71 9401 9180 9390 6 9405 178 29 9031 9275 9267 9229 9390 9301 9098 9173 9215 9292 9307 9357 9438 9304 330 9301 9316 9314 9347 9221 9290 44 18 9246 9399 9274 9468 9289 9338 9325 9386 93...
output:
No
result:
wrong answer 1st lines differ - expected: 'Yes', found: 'No'