提交记录 9019


用户 题目 状态 得分 用时 内存 语言 代码长度
shorn1 noip18a. 【NOIP2018】铺设道路 Accepted 100 995.69 us 436 KB C++11 931 B
提交时间 评测时间
2019-04-03 20:54:40 2020-08-01 01:29:25
#include<cmath>
#include<cctype>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>

#define ns namespace
#define lol long long
using ns std;

struct fastin
{
	static const int bs = 10000;
	char buf[bs];
	int p;
	fastin() : p(bs) {}
	void flush()
	{
		fread(buf, 1, bs, stdin);
		p = 0;
	}
	char gc()
	{
		if (p >= bs)
			flush();
		return buf[p++];
	}
	int operator()()
	{
		int ans = 0;
		char ch = gc();
		while (ch < '0' || ch > '9')
			ch = gc();
		while (ch >= '0' && ch <= '9')
		{
			ans *= 10;
			ans += ch - '0';
			ch = gc();
		}
		return ans;
	}
} in;

const int M = 233333;
int n;
int a[M];
lol res = 0LL;

int main(int argc,char** argv)
{
    n = in();
    for(int i = 0;i < n;i++)
    {
        a[i] = in();
    }
    res = a[0];
    for(int i = 1;i < n;i++)
    {
        res = a[i] > a[i-1] ? (res + (a[i] - a[i - 1])) : res;
    }
    printf("%lld\n",res);
    return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #133.73 us44 KBAcceptedScore: 10

Testcase #241.04 us44 KBAcceptedScore: 10

Testcase #335.02 us44 KBAcceptedScore: 10

Testcase #441.48 us44 KBAcceptedScore: 10

Testcase #535.91 us44 KBAcceptedScore: 10

Testcase #634.89 us44 KBAcceptedScore: 10

Testcase #742.96 us52 KBAcceptedScore: 10

Testcase #8123.67 us88 KBAcceptedScore: 10

Testcase #9507.76 us244 KBAcceptedScore: 10

Testcase #10995.69 us436 KBAcceptedScore: 10


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