F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_20613117_5074.cpp:4:6: error: 'bb' does not name a type
      bb)return aa;    return bb;} void make(){    int i,j,k,l;    for(i=1;i<=n;i++)    {        k = i-1;        while(k > 0 && a[k] <= a[i])k = b[k];        b[i] = k;    }     for(i=n;i>0;i--)    {        k = i+1;        while(k <= n && a[k] <= a[i])k = c[k];        c[i] = k;    }} int main(){    int i,j,k,l,cas=0;    while(scanf("%d %d",&n,&m) != EOF)    {        if(n == 0 && m == 0)break;        sum[0] = 0;        for(i=1;i<=n;i++)        {            scanf("%d",&a[i]);            sum[i] = sum[i-1] + a[i];        }        make();         L[1] = a[1]; for(i=2;i<=n;i++) { L[i] = a[i]; if(L[i] < L[i-1])L[i] = L[i-1]; }        R[n] = a[n]; for(i=n-1;i>0;i--) { R[i] = a[i]; if(R[i] < R[i+1])R[i] = R[i+1]; }         s1[1] = 0;        for(i=2;i<=n;i++)        {            s1[i] = s1[i-1] + max(L[i-1] - a[i], 0);        }        s2[n] = 0;        for(i=n-1;i>0;i--)        {            s2[i] = s2[i+1] + max(R[i+1] - a[i], 0);        }         for(i=1;i<=n;i++)        {            d[i] = 0;            k = b[i];            if(k < 1)d[i] += s1[i];            else            {                l = i-k-1; d[i] += (LL)l*a[i] - (sum[i-1]-sum[k]);             }            k = c[i];            if(k > n)d[i] += s2[i];            else            {                l = k-i-1; d[i] += (LL)l*a[i] - (sum[k-1]-sum[i]);            }        }        sort(d+1, d+1+n);        printf("Case %d: %I64d\n",++cas,d[n-m+1]);    }    return 0;}
      ^
0_0_20613117_5074.cpp:4:23: error: expected unqualified-id before 'return'
      bb)return aa;    return bb;} void make(){    int i,j,k,l;    for(i=1;i<=n;i++)    {        k = i-1;        while(k > 0 && a[k] <= a[i])k = b[k];        b[i] = k;    }     for(i=n;i>0;i--)    {        k = i+1;        while(k <= n && a[k] <= a[i])k = c[k];        c[i] = k;    }} int main(){    int i,j,k,l,cas=0;    while(scanf("%d %d",&n,&m) != EOF)    {        if(n == 0 && m == 0)break;        sum[0] = 0;        for(i=1;i<=n;i++)        {            scanf("%d",&a[i]);            sum[i] = sum[i-1] + a[i];        }        make();         L[1] = a[1]; for(i=2;i<=n;i++) { L[i] = a[i]; if(L[i] < L[i-1])L[i] = L[i-1]; }        R[n] = a[n]; for(i=n-1;i>0;i--) { R[i] = a[i]; if(R[i] < R[i+1])R[i] = R[i+1]; }         s1[1] = 0;        for(i=2;i<=n;i++)        {            s1[i] = s1[i-1] + max(L[i-1] - a[i], 0);        }        s2[n] = 0;        for(i=n-1;i>0;i--)        {            s2[i] = s2[i+1] + max(R[i+1] - a[i], 0);        }         for(i=1;i<=n;i++)        {            d[i] = 0;            k = b[i];            if(k < 1)d[i] += s1[i];            else            {                l = i-k-1; d[i] += (LL)l*a[i] - (sum[i-1]-sum[k]);             }            k = c[i];            if(k > n)d[i] += s2[i];            else            {                l = k-i-1; d[i] += (LL)l*a[i] - (sum[k-1]-sum[i]);            }        }        sort(d+1, d+1+n);        printf("Case %d: %I64d\n",++cas,d[n-m+1]);    }    return 0;}
                       ^
0_0_20613117_5074.cpp:4:33: error: expected declaration before '}' token
      bb)return aa;    return bb;} void make(){    int i,j,k,l;    for(i=1;i<=n;i++)    {        k = i-1;        while(k > 0 && a[k] <= a[i])k = b[k];        b[i] = k;    }     for(i=n;i>0;i--)    {        k = i+1;        while(k <= n && a[k] <= a[i])k = c[k];        c[i] = k;    }} int main(){    int i,j,k,l,cas=0;    while(scanf("%d %d",&n,&m) != EOF)    {        if(n == 0 && m == 0)break;        sum[0] = 0;        for(i=1;i<=n;i++)        {            scanf("%d",&a[i]);            sum[i] = sum[i-1] + a[i];        }        make();         L[1] = a[1]; for(i=2;i<=n;i++) { L[i] = a[i]; if(L[i] < L[i-1])L[i] = L[i-1]; }        R[n] = a[n]; for(i=n-1;i>0;i--) { R[i] = a[i]; if(R[i] < R[i+1])R[i] = R[i+1]; }         s1[1] = 0;        for(i=2;i<=n;i++)        {            s1[i] = s1[i-1] + max(L[i-1] - a[i], 0);        }        s2[n] = 0;        for(i=n-1;i>0;i--)        {            s2[i] = s2[i+1] + max(R[i+1] - a[i], 0);        }         for(i=1;i<=n;i++)        {            d[i] = 0;            k = b[i];            if(k < 1)d[i] += s1[i];            else            {                l = i-k-1; d[i] += (LL)l*a[i] - (sum[i-1]-sum[k]);             }            k = c[i];            if(k > n)d[i] += s2[i];            else            {                l = k-i-1; d[i] += (LL)l*a[i] - (sum[k-1]-sum[i]);            }        }        sort(d+1, d+1+n);        printf("Case %d: %I64d\n",++cas,d[n-m+1]);    }    return 0;}
                                 ^


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-29 21:32:05, Gzip enabled