提交记录 8364


用户 题目 状态 得分 用时 内存 语言 代码长度
M_sea noip18a. 【NOIP2018】铺设道路 Accepted 100 2.995 ms 428 KB C++ 388 B
提交时间 评测时间
2019-02-13 15:25:24 2020-08-01 01:17:28
#include <algorithm>
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
using namespace std;
int h[100000];
int n;
int f(int l,int r)
{
    if (l==r) return h[l];
    int mid=(l+r)>>1;
    return f(l,mid)+f(mid+1,r)-min(h[mid],h[mid+1]);
}
int main()
{
    scanf("%d",&n);
    for (int i=1;i<=n;i++) scanf("%d",h+i-1);
    printf("%d\n",f(0,n-1));
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #136.22 us44 KBAcceptedScore: 10

Testcase #243.48 us44 KBAcceptedScore: 10

Testcase #338.03 us44 KBAcceptedScore: 10

Testcase #436.76 us44 KBAcceptedScore: 10

Testcase #537.75 us44 KBAcceptedScore: 10

Testcase #642.93 us44 KBAcceptedScore: 10

Testcase #764.34 us48 KBAcceptedScore: 10

Testcase #8320.19 us84 KBAcceptedScore: 10

Testcase #91.531 ms240 KBAcceptedScore: 10

Testcase #102.995 ms428 KBAcceptedScore: 10


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