提交记录 9753


用户 题目 状态 得分 用时 内存 语言 代码长度
OrientalHorizon noip18a. 【NOIP2018】铺设道路 Accepted 100 4.849 ms 404 KB C++ 732 B
提交时间 评测时间
2019-07-12 11:28:33 2020-08-01 01:51:17
#include <cstdio>
using namespace std;
int n,a[100003],mina,ans;
void clear(int p,int q,int r)
{
    for(int i=p;i<=q;i++)
        a[i]-=r;
    return;
}
int main()
{
    int i,j;
    scanf("%d",&n);
    for(i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(i=1;i<=n;i++)
        while(a[i]!=0)
        {
            mina=2147483646;
            for(j=i;j<=n;j++)
                if(a[j]!=0)
                {    
                    if(mina>a[j])
                        mina=a[j];
                    if(a[j+1]==0)
                    {
                        clear(i,j,mina);
                        ans+=mina;
                        break;
                    }
                }
        }
    printf("%d",ans);
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #19.27 us20 KBAcceptedScore: 10

Testcase #211.84 us20 KBAcceptedScore: 10

Testcase #312.19 us20 KBAcceptedScore: 10

Testcase #410.72 us20 KBAcceptedScore: 10

Testcase #511.65 us20 KBAcceptedScore: 10

Testcase #620.64 us20 KBAcceptedScore: 10

Testcase #754.69 us24 KBAcceptedScore: 10

Testcase #8446.92 us56 KBAcceptedScore: 10

Testcase #92.431 ms216 KBAcceptedScore: 10

Testcase #104.849 ms404 KBAcceptedScore: 10


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:12:16 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠