1996: [Hnoi2010]chorus Chorus Team

Source: Internet
Author: User

1996: [Hnoi2010]chorus Chorus time limit:4 Sec Memory limit:64 MB
submit:1057 solved:681
[Submit] [Status] [Discuss] Descriptioninputoutputsample Input4
1701 1702 1703 1704Sample Output8HINT

Source

Solution: Meng Meng DP problem, in fact, and I first thought of the violence method is very close, basically is the memory of violence, and then into a circular form (hansbug: No effect of this thing is cool ^_^), and then just AC (PS: But the first time the memory of the violence WA dropped is what Ghost??? )
1/**************************************************************2Problem:19963 User:hansbug4 language:pascal5 result:accepted6Time:108Ms7Memory:8172KB8****************************************************************/9  Ten Constp=19650827; One var A I,j,k,l,m,n:longint; -C:Array[0..10000] ofLongint; -A:Array[0..1005,0..1005,1..2] ofLongint; the begin - READLN (n); -       fori:=1  toN Do -          begin + read (c[i]); -A[i,i,0]:=1; +          End; A Readln; at       fori:=n-1 Downto 1  Do -           forj:=i+1  toN Do -              begin -A[i,j,0]:=0; A[i,j,1]:=0; -                   ifc[i]<c[i+1] ThenInc (A[I,J,0],a[i+1J0]); -                   ifC[I]&LT;C[J] ThenInc (A[I,J,0],a[i+1J1]); in                   ifC[j]>c[i] ThenInc (A[I,J,1],a[i,j-1,0]); -                   ifc[j]>c[j-1] ThenInc (A[I,J,1],a[i,j-1,1]); toA[i,j,0]:=a[i,j,0]MoDp; +A[i,j,1]:=a[i,j,1]MoDp; -              End; theWriteln ((a[1N1]+a[1N0])MoDp); * Readln; $ End.

1996: [Hnoi2010]chorus Chorus Team

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.