QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#105694 | #5475. Make a Loop | Nicolas125841 | AC ✓ | 115ms | 10940kb | C++14 | 798b | 2023-05-15 00:11:20 | 2023-05-15 00:11:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main(){
cin.tie(NULL)->sync_with_stdio(false);
int n, sum = 0;
cin >> n;
vector<int> ar(n);
for(int i = 0; i < n; i++){
cin >> ar[i];
sum += ar[i];
}
if(sum & 1){
cout << "No\n";
return 0;
}
vector<int> ev(1000001, 0), od(1000001, 0);
ev[0] = 1;
for(int i = 0; i < n; i++){
for(int j = 1000000-ar[i]; j >= 0; j--){
if(ev[j] && od[j+ar[i]] < 4)
od[j+ar[i]] += ev[j];
if(od[j] && ev[j+ar[i]] < 4)
ev[j+ar[i]] += od[j];
}
}
if(ev[sum>>1] >= 4)
cout << "Yes\n";
else
cout << "No\n";
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 5ms
memory: 10800kb
input:
4 1 1 1 1
output:
Yes
result:
ok single line: 'Yes'
Test #2:
score: 0
Accepted
time: 6ms
memory: 10932kb
input:
6 1 3 1 3 1 3
output:
Yes
result:
ok single line: 'Yes'
Test #3:
score: 0
Accepted
time: 11ms
memory: 10784kb
input:
6 2 2 1 1 1 1
output:
No
result:
ok single line: 'No'
Test #4:
score: 0
Accepted
time: 4ms
memory: 10828kb
input:
8 99 98 15 10 10 5 2 1
output:
Yes
result:
ok single line: 'Yes'
Test #5:
score: 0
Accepted
time: 110ms
memory: 10784kb
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: 110ms
memory: 10800kb
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: 106ms
memory: 10936kb
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: 112ms
memory: 10820kb
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: 115ms
memory: 10828kb
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: 107ms
memory: 10800kb
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: 113ms
memory: 10872kb
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: 109ms
memory: 10784kb
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: 104ms
memory: 10872kb
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: 111ms
memory: 10800kb
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: 84ms
memory: 10872kb
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: 85ms
memory: 10812kb
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: 63ms
memory: 10832kb
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: 79ms
memory: 10868kb
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: 29ms
memory: 10804kb
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: 71ms
memory: 10868kb
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: 35ms
memory: 10784kb
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: 60ms
memory: 10772kb
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: 51ms
memory: 10808kb
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: 30ms
memory: 10796kb
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: 65ms
memory: 10872kb
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: 29ms
memory: 10800kb
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: 91ms
memory: 10796kb
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: 29ms
memory: 10800kb
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: 42ms
memory: 10788kb
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: 64ms
memory: 10772kb
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: 79ms
memory: 10932kb
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: 50ms
memory: 10796kb
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: 70ms
memory: 10788kb
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: 20ms
memory: 10828kb
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: 93ms
memory: 10936kb
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: 0
Accepted
time: 86ms
memory: 10868kb
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:
Yes
result:
ok single line: 'Yes'
Test #37:
score: 0
Accepted
time: 17ms
memory: 10936kb
input:
16 13 41 81 67 42 24 25 78 2 3 76 52 26 69 31 74
output:
Yes
result:
ok single line: 'Yes'
Test #38:
score: 0
Accepted
time: 0ms
memory: 3364kb
input:
10 83 74 32 76 12 59 97 82 17 7
output:
No
result:
ok single line: 'No'
Test #39:
score: 0
Accepted
time: 21ms
memory: 10816kb
input:
20 58 59 94 61 45 28 55 33 95 71 95 55 67 52 3 63 53 94 82 59
output:
Yes
result:
ok single line: 'Yes'
Test #40:
score: 0
Accepted
time: 10ms
memory: 10852kb
input:
4 35 34 25 38
output:
No
result:
ok single line: 'No'
Test #41:
score: 0
Accepted
time: 15ms
memory: 10828kb
input:
12 90 23 29 7 65 61 99 1 29 67 68 21
output:
Yes
result:
ok single line: 'Yes'
Test #42:
score: 0
Accepted
time: 14ms
memory: 10864kb
input:
16 75 77 99 3 27 78 47 74 25 26 78 3 99 73 49 99
output:
No
result:
ok single line: 'No'
Test #43:
score: 0
Accepted
time: 9ms
memory: 10872kb
input:
6 61 61 75 7 83 1
output:
Yes
result:
ok single line: 'Yes'
Test #44:
score: 0
Accepted
time: 2ms
memory: 3432kb
input:
10 26 24 31 63 31 33 31 49 41 6
output:
No
result:
ok single line: 'No'
Test #45:
score: 0
Accepted
time: 8ms
memory: 10756kb
input:
6 98 12 7 79 88 88
output:
Yes
result:
ok single line: 'Yes'
Test #46:
score: 0
Accepted
time: 17ms
memory: 10932kb
input:
18 10 50 78 48 76 30 26 16 10 48 76 90 66 32 8 100 34 16
output:
No
result:
ok single line: 'No'
Test #47:
score: 0
Accepted
time: 12ms
memory: 10764kb
input:
12 693 297 170 205 652 718 802 266 240 479 469 59
output:
Yes
result:
ok single line: 'Yes'
Test #48:
score: 0
Accepted
time: 14ms
memory: 10764kb
input:
12 263 182 227 683 463 494 421 299 42 446 521 467
output:
No
result:
ok single line: 'No'
Test #49:
score: 0
Accepted
time: 11ms
memory: 10844kb
input:
14 583 663 391 837 870 474 770 421 129 475 699 409 780 763
output:
Yes
result:
ok single line: 'Yes'
Test #50:
score: 0
Accepted
time: 2ms
memory: 3288kb
input:
20 181 198 889 979 478 197 105 322 416 526 59 61 894 754 665 965 991 501 559 647
output:
No
result:
ok single line: 'No'
Test #51:
score: 0
Accepted
time: 10ms
memory: 10876kb
input:
6 275 65 212 275 528 805
output:
Yes
result:
ok single line: 'Yes'
Test #52:
score: 0
Accepted
time: 20ms
memory: 10868kb
input:
20 951 397 89 731 681 241 957 575 517 223 671 373 457 367 141 499 935 723 63 971
output:
No
result:
ok single line: 'No'
Test #53:
score: 0
Accepted
time: 27ms
memory: 10804kb
input:
20 178 621 830 344 893 2 813 623 40 761 258 235 63 47 642 479 214 360 355 374
output:
Yes
result:
ok single line: 'Yes'
Test #54:
score: 0
Accepted
time: 12ms
memory: 10848kb
input:
14 683 943 319 690 434 303 960 465 863 811 789 222 927 151
output:
No
result:
ok single line: 'No'
Test #55:
score: 0
Accepted
time: 26ms
memory: 10820kb
input:
20 182 112 766 561 84 907 151 116 215 189 451 549 485 11 78 766 401 587 115 904
output:
Yes
result:
ok single line: 'Yes'
Test #56:
score: 0
Accepted
time: 2ms
memory: 3288kb
input:
12 79 309 504 85 23 361 797 869 733 846 167 522
output:
No
result:
ok single line: 'No'
Test #57:
score: 0
Accepted
time: 13ms
memory: 10940kb
input:
18 3555 4156 7244 7005 228 2560 4997 2856 9474 8597 2857 6983 3305 5485 2014 9360 4429 633
output:
Yes
result:
ok single line: 'Yes'
Test #58:
score: 0
Accepted
time: 13ms
memory: 10936kb
input:
16 3121 7467 8991 140 1097 8320 7236 6252 8231 8774 6254 5660 4520 573 6845 6071
output:
No
result:
ok single line: 'No'
Test #59:
score: 0
Accepted
time: 20ms
memory: 10796kb
input:
20 6586 491 5517 4098 7232 1920 9804 8345 8567 1446 238 7930 4432 1114 3694 8307 9284 1982 2185 2062
output:
Yes
result:
ok single line: 'Yes'
Test #60:
score: 0
Accepted
time: 7ms
memory: 10804kb
input:
6 8393 3947 5075 9457 1538 654
output:
No
result:
ok single line: 'No'
Test #61:
score: 0
Accepted
time: 17ms
memory: 10820kb
input:
16 2558 3029 271 7472 5671 5485 6026 2532 9948 7397 2323 2608 5523 5167 2321 927
output:
Yes
result:
ok single line: 'Yes'
Test #62:
score: 0
Accepted
time: 2ms
memory: 3444kb
input:
14 5012 1884 3506 2730 5530 7713 6259 8330 8396 8975 8845 5559 6952 5808
output:
No
result:
ok single line: 'No'
Test #63:
score: 0
Accepted
time: 8ms
memory: 10940kb
input:
10 6822 7611 108 8091 8284 5414 3216 1301 4048 4241
output:
Yes
result:
ok single line: 'Yes'
Test #64:
score: 0
Accepted
time: 19ms
memory: 10744kb
input:
14 270 1152 4500 5133 4625 8988 3088 5147 2092 4085 5729 9641 5847 6093
output:
No
result:
ok single line: 'No'
Test #65:
score: 0
Accepted
time: 13ms
memory: 10940kb
input:
12 4280 5665 6350 4831 1512 8158 3843 4399 5948 889 1597 7338
output:
Yes
result:
ok single line: 'Yes'
Test #66:
score: 0
Accepted
time: 23ms
memory: 10936kb
input:
20 6513 5035 8449 738 560 5043 4633 7646 6464 9741 6986 8244 5755 6683 2599 9461 5097 5687 8267 7263
output:
No
result:
ok single line: 'No'