QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#301601#5475. Make a LoopDAleksaAC ✓56ms5572kbC++141001b2024-01-10 03:43:352024-01-10 03:43:35

Judging History

你现在查看的是最新测评结果

  • [2024-01-10 03:43:35]
  • 评测
  • 测评结果:AC
  • 用时:56ms
  • 内存:5572kb
  • [2024-01-10 03:43:35]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int S=5e5+1;
const int N=100,MX=63;
int n;
int a[N];
int sum;
unsigned short int dp[2][S];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    cin>>a[0];
    sum=a[0];
    bool ok=true;
    for(int i=1;i<n;++i){
        cin>>a[i];
        if(a[i]!=a[i-1])ok=false;
        sum+=a[i];
    }
    if(n&1){
        cout<<"No";
        return 0;
    }
    if(sum&1){
        cout<<"No";
        return 0;
    }
    if(ok){
        cout<<"Yes";
        return 0;
    }
    dp[0][0] = 1;
    for(int i=0;i<n;++i){
        if(dp[0][sum/2]>=4){
            cout<<"Yes";
            return 0;
        }
        for(int s=S;s>=a[i];--s){
            dp[0][s]+=dp[1][s-a[i]];
            if(dp[0][s]>MX)dp[0][s]=MX;
            dp[1][s]+=dp[0][s-a[i]];
            if(dp[1][s]>MX)dp[1][s]=MX;
        }
    }
    if(dp[0][sum/2]>=4)cout<<"Yes";
    else cout<<"No";
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3604kb

input:

4
1 1 1 1

output:

Yes

result:

ok single line: 'Yes'

Test #2:

score: 0
Accepted
time: 5ms
memory: 5400kb

input:

6
1 3 1 3 1 3

output:

Yes

result:

ok single line: 'Yes'

Test #3:

score: 0
Accepted
time: 0ms
memory: 5388kb

input:

6
2 2 1 1 1 1

output:

No

result:

ok single line: 'No'

Test #4:

score: 0
Accepted
time: 6ms
memory: 5404kb

input:

8
99 98 15 10 10 5 2 1

output:

Yes

result:

ok single line: 'Yes'

Test #5:

score: 0
Accepted
time: 50ms
memory: 5408kb

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: 56ms
memory: 5392kb

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: 45ms
memory: 5400kb

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: 50ms
memory: 5300kb

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: 45ms
memory: 5296kb

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: 53ms
memory: 5344kb

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: 46ms
memory: 5404kb

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: 46ms
memory: 5452kb

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: 49ms
memory: 5568kb

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: 49ms
memory: 5352kb

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: 43ms
memory: 5448kb

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: 54ms
memory: 5392kb

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: 31ms
memory: 5392kb

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: 44ms
memory: 5348kb

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: 15ms
memory: 5344kb

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: 43ms
memory: 5408kb

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: 12ms
memory: 5404kb

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: 26ms
memory: 5396kb

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: 28ms
memory: 5572kb

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: 18ms
memory: 5348kb

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: 36ms
memory: 5564kb

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: 16ms
memory: 5516kb

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: 50ms
memory: 5344kb

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: 16ms
memory: 5388kb

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: 25ms
memory: 5400kb

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: 37ms
memory: 5564kb

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: 39ms
memory: 5572kb

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: 22ms
memory: 5404kb

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: 36ms
memory: 5340kb

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: 7ms
memory: 5340kb

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: 49ms
memory: 5264kb

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: 0ms
memory: 3452kb

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: 5ms
memory: 5344kb

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: 3616kb

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: 9ms
memory: 5292kb

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: 0ms
memory: 5560kb

input:

4
35 34 25 38

output:

No

result:

ok single line: 'No'

Test #41:

score: 0
Accepted
time: 8ms
memory: 5292kb

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: 10ms
memory: 5516kb

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: 0ms
memory: 5392kb

input:

6
61 61 75 7 83 1

output:

Yes

result:

ok single line: 'Yes'

Test #44:

score: 0
Accepted
time: 0ms
memory: 3624kb

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: 5ms
memory: 5348kb

input:

6
98 12 7 79 88 88

output:

Yes

result:

ok single line: 'Yes'

Test #46:

score: 0
Accepted
time: 7ms
memory: 5444kb

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: 8ms
memory: 5400kb

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: 4ms
memory: 5404kb

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: 9ms
memory: 5388kb

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: 0ms
memory: 3444kb

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: 0ms
memory: 5564kb

input:

6
275 65 212 275 528 805

output:

Yes

result:

ok single line: 'Yes'

Test #52:

score: 0
Accepted
time: 9ms
memory: 5336kb

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: 4ms
memory: 5516kb

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: 9ms
memory: 5400kb

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: 4ms
memory: 5568kb

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: 0ms
memory: 3612kb

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: 10ms
memory: 5396kb

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: 9ms
memory: 5392kb

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: 7ms
memory: 5292kb

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: 5ms
memory: 5292kb

input:

6
8393 3947 5075 9457 1538 654

output:

No

result:

ok single line: 'No'

Test #61:

score: 0
Accepted
time: 10ms
memory: 5348kb

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: 0ms
memory: 3628kb

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: 7ms
memory: 5396kb

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: 4ms
memory: 5348kb

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: 8ms
memory: 5572kb

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: 7ms
memory: 5336kb

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'