QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#301551 | #5475. Make a Loop | DAleksa | WA | 505ms | 57928kb | C++14 | 708b | 2024-01-10 03:04:09 | 2024-01-10 03:04:09 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
vector<int> a(n);
int sum = 0;
for(int i = 0; i < n; i++) {
cin >> a[i];
sum += a[i];
}
if(n % 2 == 1 || sum % 2 == 1) {
cout << "No";
return 0;
}
vector<vector<int>> dp(1000010, vector<int>(2, 0));
dp[0][0] = 1;
for(int i = 0; i < n; i++) {
for(int s = 1000009; s >= a[i]; s--) {
dp[s][0] += dp[s - a[i]][1];
dp[s][1] += dp[s - a[i]][0];
}
}
if(dp[sum / 2][0] >= 4) cout << "Yes";
else cout << "No";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 46ms
memory: 57756kb
input:
4 1 1 1 1
output:
Yes
result:
ok single line: 'Yes'
Test #2:
score: 0
Accepted
time: 47ms
memory: 57752kb
input:
6 1 3 1 3 1 3
output:
Yes
result:
ok single line: 'Yes'
Test #3:
score: 0
Accepted
time: 40ms
memory: 57700kb
input:
6 2 2 1 1 1 1
output:
No
result:
ok single line: 'No'
Test #4:
score: 0
Accepted
time: 47ms
memory: 57764kb
input:
8 99 98 15 10 10 5 2 1
output:
Yes
result:
ok single line: 'Yes'
Test #5:
score: 0
Accepted
time: 480ms
memory: 57776kb
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: 475ms
memory: 57868kb
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: 458ms
memory: 57768kb
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: 438ms
memory: 57736kb
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: 446ms
memory: 57928kb
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: 448ms
memory: 57812kb
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: 468ms
memory: 57916kb
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: 461ms
memory: 57724kb
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: 486ms
memory: 57792kb
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: 0
Accepted
time: 479ms
memory: 57860kb
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:
Yes
result:
ok single line: 'Yes'
Test #15:
score: 0
Accepted
time: 380ms
memory: 57792kb
input:
86 949 929 899 943 934 917 922 903 936 909 912 953 810 959 894 912 929 889 908 904 944 896 899 903 907 923 907 949 851 900 975 922 906 920 930 907 905 916 917 877 849 920 937 887 937 895 900 849 894 927 883 876 906 996 954 939 845 882 883 898 930 929 922 919 898 925 946 928 910 912 907 895 872 945 9...
output:
No
result:
ok single line: 'No'
Test #16:
score: 0
Accepted
time: 432ms
memory: 57784kb
input:
98 930 898 910 918 920 927 901 928 913 943 915 953 916 933 915 893 946 889 939 922 946 958 911 933 921 898 918 907 912 920 965 893 897 947 863 928 928 928 915 895 906 916 929 909 880 947 915 953 914 914 921 871 919 861 881 882 934 920 915 962 893 902 889 912 896 893 891 855 982 877 899 919 910 954 8...
output:
Yes
result:
ok single line: 'Yes'
Test #17:
score: 0
Accepted
time: 320ms
memory: 57756kb
input:
68 909 896 897 917 880 886 869 911 896 33 913 893 920 897 899 903 896 891 878 20 912 924 901 891 912 17 28 915 882 901 902 896 906 908 894 900 934 912 918 906 897 893 906 948 907 905 919 19 932 932 906 898 913 2 869 910 933 887 899 873 904 903 908 904 43 955 916 910
output:
No
result:
ok single line: 'No'
Test #18:
score: 0
Accepted
time: 407ms
memory: 57828kb
input:
86 892 899 836 831 858 881 928 890 814 868 861 875 891 887 855 858 864 844 853 838 871 853 855 878 867 890 895 865 888 865 861 874 881 883 898 863 810 883 873 880 829 900 796 848 901 876 939 874 868 877 890 854 852 868 887 875 856 867 848 812 855 875 842 863 908 867 865 861 908 877 860 874 865 846 8...
output:
Yes
result:
ok single line: 'Yes'
Test #19:
score: 0
Accepted
time: 157ms
memory: 57712kb
input:
28 538 894 915 386 833 911 889 486 208 156 529 820 412 421 451 963 989 946 451 464 807 178 451 100 499 716 356 295
output:
No
result:
ok single line: 'No'
Test #20:
score: 0
Accepted
time: 355ms
memory: 57800kb
input:
76 947 974 902 929 914 920 931 940 937 946 934 928 938 939 24 921 944 20 955 947 940 898 899 926 951 930 9 913 16 934 924 917 925 5 904 918 907 925 2 8 898 943 939 939 934 927 926 956 935 932 929 935 911 932 926 929 925 10 934 14 944 953 903 935 956 937 53 936 925 27 942 942 929 926 917 928
output:
Yes
result:
ok single line: 'Yes'
Test #21:
score: 0
Accepted
time: 137ms
memory: 57872kb
input:
28 944 48 986 951 945 886 914 868 8 981 958 883 947 931 857 925 73 977 882 880 970 889 949 912 891 932 978 911
output:
No
result:
ok single line: 'No'
Test #22:
score: 0
Accepted
time: 243ms
memory: 57816kb
input:
52 913 883 43 869 883 877 902 891 882 866 902 7 911 849 900 862 874 35 926 891 928 914 908 900 906 4 896 4 900 897 903 893 28 855 23 860 919 875 925 5 936 903 873 891 6 12 888 882 24 925 855 904
output:
Yes
result:
ok single line: 'Yes'
Test #23:
score: 0
Accepted
time: 243ms
memory: 57804kb
input:
54 758 831 860 909 854 790 886 864 831 788 861 868 878 846 824 855 882 780 824 888 895 877 798 862 884 841 938 790 889 829 857 809 840 865 876 853 841 788 833 828 840 774 848 809 962 789 937 856 858 835 880 834 853 835
output:
No
result:
ok single line: 'No'
Test #24:
score: 0
Accepted
time: 174ms
memory: 57748kb
input:
34 870 854 949 873 856 775 914 814 851 823 899 991 819 829 855 820 746 866 861 967 749 894 854 795 831 925 881 915 980 754 945 794 947 824
output:
Yes
result:
ok single line: 'Yes'
Test #25:
score: 0
Accepted
time: 364ms
memory: 57796kb
input:
80 20 920 924 929 928 22 934 922 898 912 3 926 930 914 926 924 937 922 926 954 907 908 914 14 908 3 923 890 933 921 919 947 53 950 912 925 1 928 932 12 24 915 928 934 914 913 927 915 11 938 932 899 932 6 916 909 947 947 941 945 905 1 934 5 917 944 932 910 922 915 914 931 32 14 926 916 936 22 12 916
output:
No
result:
ok single line: 'No'
Test #26:
score: 0
Accepted
time: 158ms
memory: 57784kb
input:
30 926 832 781 877 806 841 850 444 951 803 840 892 850 820 797 815 636 840 892 909 788 828 775 788 826 828 861 753 779 938
output:
Yes
result:
ok single line: 'Yes'
Test #27:
score: 0
Accepted
time: 438ms
memory: 57860kb
input:
100 940 931 945 931 944 934 937 939 926 937 936 964 943 934 930 945 931 932 931 942 939 945 934 943 942 918 940 2 938 946 944 942 935 943 15 9 11 935 952 948 932 957 12 946 954 942 947 952 949 935 949 938 944 941 7 933 942 945 958 937 936 40 943 924 939 14 939 932 949 936 914 928 948 954 899 938 2 9...
output:
No
result:
ok single line: 'No'
Test #28:
score: 0
Accepted
time: 145ms
memory: 57780kb
input:
30 853 760 809 872 963 822 821 935 939 769 838 905 892 905 891 839 791 923 624 830 697 877 767 783 921 867 752 815 755 867
output:
Yes
result:
ok single line: 'Yes'
Test #29:
score: 0
Accepted
time: 236ms
memory: 57752kb
input:
48 32 894 21 961 908 941 912 909 884 902 31 8 907 936 71 876 899 908 930 915 947 922 927 26 859 16 923 909 57 911 926 4 906 911 7 949 912 929 911 909 898 939 881 934 64 925 912 887
output:
No
result:
ok single line: 'No'
Test #30:
score: 0
Accepted
time: 363ms
memory: 57768kb
input:
72 938 902 901 922 946 7 917 917 906 3 907 912 932 2 910 918 14 919 920 899 915 926 13 915 5 896 896 910 913 921 52 915 932 921 905 15 923 21 921 912 8 915 931 919 907 929 918 901 917 36 30 42 913 902 26 912 58 927 916 893 930 920 913 950 925 919 37 902 953 38 918 914
output:
Yes
result:
ok single line: 'Yes'
Test #31:
score: 0
Accepted
time: 405ms
memory: 57752kb
input:
86 886 884 855 891 899 872 886 878 900 885 886 915 889 935 930 898 914 894 897 884 900 897 904 912 927 834 903 922 884 906 869 900 862 870 901 953 866 892 847 907 874 889 894 917 897 895 935 882 873 856 901 860 856 904 944 917 875 921 869 893 849 895 878 845 868 885 906 882 880 872 902 849 792 868 9...
output:
No
result:
ok single line: 'No'
Test #32:
score: 0
Accepted
time: 231ms
memory: 57840kb
input:
48 863 933 928 922 935 18 21 937 927 57 931 926 61 983 944 922 937 894 940 64 944 944 930 21 918 928 907 916 914 941 948 29 918 34 33 944 927 951 16 916 931 943 7 950 982 955 920 882
output:
Yes
result:
ok single line: 'Yes'
Test #33:
score: 0
Accepted
time: 328ms
memory: 57804kb
input:
72 13 943 938 900 982 928 934 916 927 965 938 957 940 8 928 931 935 921 940 930 947 945 936 934 5 901 936 935 924 934 12 951 929 40 16 934 925 943 939 931 923 14 946 936 942 954 936 5 947 969 923 935 941 927 931 884 909 942 920 1 979 934 942 954 37 934 930 9 23 56 961 959
output:
No
result:
ok single line: 'No'
Test #34:
score: 0
Accepted
time: 109ms
memory: 57792kb
input:
20 229 679 881 992 986 847 899 757 977 884 736 259 667 998 355 751 667 619 992 105
output:
Yes
result:
ok single line: 'Yes'
Test #35:
score: 0
Accepted
time: 505ms
memory: 57788kb
input:
100 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10...
output:
No
result:
ok single line: 'No'
Test #36:
score: -100
Wrong Answer
time: 503ms
memory: 57780kb
input:
100 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10000 10...
output:
No
result:
wrong answer 1st lines differ - expected: 'Yes', found: 'No'