提交记录 11184


用户 题目 状态 得分 用时 内存 语言 代码长度
lzj noip18a. 【NOIP2018】铺设道路 Accepted 100 869.455 ms 424 KB C++ 605 B
提交时间 评测时间
2019-11-02 21:16:54 2020-08-01 02:39:50
#include<iostream>
#include<cstdio>
#include<math.h>
using namespace std;
int main ()
{
	//'freopen("in.txt","r",stdin);
	int n=0;
	int day=0;
	cin>>n;
	int d[100000];
	for(int i=1;i<=n;i++)//the road
	{
		cin>>d[i];
		//cout<<d[i];
	}
	for(int i=1;i<=n;i++)// turn them to zero one by one
	{
		while(d[i]!=0)//if the current part isn't zero,make it zero
		{	
			int b=i;//end
			for (int a=i;a<=n;a++)//find the end of the part to build
			{	if 	(d[a]==0)
				{	b=a-1;
					break;
				}
				b=a;
			}
			for (int c=i;c<=b;c++)//build
			{	
				d[c]=d[c]-1;
			}
			day++;
		}	
	}
	cout<<day;
 return 0;
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #162.11 us424 KBAcceptedScore: 10

Testcase #267.99 us424 KBAcceptedScore: 10

Testcase #363.92 us424 KBAcceptedScore: 10

Testcase #464.32 us424 KBAcceptedScore: 10

Testcase #570.09 us424 KBAcceptedScore: 10

Testcase #6314.81 us424 KBAcceptedScore: 10

Testcase #71.021 ms424 KBAcceptedScore: 10

Testcase #89.731 ms424 KBAcceptedScore: 10

Testcase #9433.151 ms424 KBAcceptedScore: 10

Testcase #10869.455 ms424 KBAcceptedScore: 10


Judge Duck Online | 评测鸭在线
Server Time: 2026-03-28 06:47:42 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠