记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Wrong Answer 1ms 216.0 KiB
#2 Wrong Answer 1ms 224.0 KiB
#3 Wrong Answer 1ms 228.0 KiB
#4 Wrong Answer 1ms 220.0 KiB
#5 Wrong Answer 1ms 228.0 KiB
#6 Wrong Answer 1ms 224.0 KiB
#7 Wrong Answer 2ms 356.0 KiB
#8 Wrong Answer 2ms 352.0 KiB
#9 Wrong Answer 2ms 612.0 KiB
#10 Wrong Answer 2ms 608.0 KiB
#11 Wrong Answer 1ms 612.0 KiB
#12 Wrong Answer 1ms 608.0 KiB
#13 Wrong Answer 8ms 8.035 MiB
#14 Wrong Answer 13ms 9.965 MiB
#15 Wrong Answer 20ms 11.934 MiB
#16 Wrong Answer 58ms 31.191 MiB
#17 Wrong Answer 89ms 46.605 MiB
#18 Wrong Answer 110ms 54.363 MiB
#19 Wrong Answer 134ms 62.07 MiB
#20 Wrong Answer 202ms 69.781 MiB

代码

#include<bits/stdc++.h>
using namespace std;
const int maxn=1010,maxm=10010,maxk=100010;
int n,m,k,d[maxn],nm[maxn],f[maxk][maxn],pp[maxn];
struct aaa
{
	int t,a,b;
}a[maxm];
bool cmp(aaa x,aaa y)
{
	if(x.a!=y.a)return x.a<y.a;
	return x.t<y.t;
}

int main()
{
	scanf("%d%d%d",&n,&m,&k);
	for(int i=1;i<n;i++)
		scanf("%d",&d[i]);
	for(int i=1;i<=m;i++)
		scanf("%d%d%d",&a[i].t,&a[i].a,&a[i].b);
	sort(a+1,a+m+1,cmp);
	for(int i=1;i<=m;i++)
		nm[a[i].a]=max(a[i].t,nm[a[i].a]);
	for(int i=1;i<=m;i++)
		for(int j=a[i].a;j<a[i].b;j++)
			pp[j]++;
	for(int i=0;i<=k;i++)
		f[i][1]=nm[1];
	for(int i=1;i<=k;i++)
		for(int j=1;j<=n;j++)
		{
			f[i][j]=min(f[i-1][j-1]+(d[j-1]-1)*pp[i-1],f[i][j-1]+d[j-1]*pp[i-1]);
			if(i-d[j-1]>=0)f[i][j]=min(f[i][j],f[i-d[j-1]][j-1]+d[j-1]*pp[i-1]);
		}
	printf("%d",f[k][n]);
	return 0;
}

信息

递交者
类型
递交
题目
P1037 观光公交
比赛
随机真题赛第一轮(xhy&lfy讲题)
题目数据
下载
语言
C++
递交时间
2019-11-11 15:16:19
评测时间
2019-11-11 15:16:19
评测机
分数
0
总耗时
659ms
峰值内存
69.781 MiB