提交记录 8364
提交时间 |
评测时间 |
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;
}
Compilation | N/A | N/A | Compile OK | Score: N/A | 显示更多 |
Testcase #1 | 36.22 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #2 | 43.48 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #3 | 38.03 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #4 | 36.76 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #5 | 37.75 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #6 | 42.93 us | 44 KB | Accepted | Score: 10 | 显示更多 |
Testcase #7 | 64.34 us | 48 KB | Accepted | Score: 10 | 显示更多 |
Testcase #8 | 320.19 us | 84 KB | Accepted | Score: 10 | 显示更多 |
Testcase #9 | 1.531 ms | 240 KB | Accepted | Score: 10 | 显示更多 |
Testcase #10 | 2.995 ms | 428 KB | Accepted | Score: 10 | 显示更多 |
Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:14:36 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠