区间dp-送外卖

author author     2022-09-20     248

关键词:

When we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this time, we may call for food delivery.

Suppose there are N people living in a straight street that is just lies on an X-coordinate axis. The ith person‘s coordinate is Xi meters. And in the street there is a take-out restaurant which has coordinates X meters. One day at lunchtime, each person takes an order from the restaurant at the same time. As a worker in the restaurant, you need to start from the restaurant, send food to the N people, and then come back to the restaurant. Your speed is V-1 meters per minute.

You know that the N people have different personal characters; therefore they have different feeling on the time their food arrives. Their feelings are measured by Displeasure Index. At the beginning, the Displeasure Index for each person is 0. When waiting for the food, the ith person will gain Bi Displeasure Index per minute.

If one‘s Displeasure Index goes too high, he will not buy your food any more. So you need to keep the sum of all people‘s Displeasure Index as low as possible in order to maximize your income. Your task is to find the minimal sum of Displeasure Index.

Input

The input contains multiple test cases, separated with a blank line. Each case is started with three integers N ( 1 <= N <= 1000 ), V ( V > 0), X ( X >= 0 ), then N lines followed. Each line contains two integers Xi ( Xi >= 0 ), Bi ( Bi >= 0), which are described above.

You can safely assume that all numbers in the input and output will be less than 231 - 1.

Please process to the end-of-file.

Output

For each test case please output a single number, which is the minimal sum of Displeasure Index. One test case per line.

Sample Input

5 1 0
1 1
2 2
3 3
4 4
5 5

Sample Output

55


代码示例:

  

fixingthegreatwalluva-1336(区间dp)

...个点修缮费用为ci,单位时间增加费用di,问最少费用。区间dp和送外卖那个差不多~有一个细节,输入不加!=EOF的话会超时(虽然题目说了以00结束)1#include<cstdio>2#include<bits/stdc++.h>3usingnamespacest 查看详情

fooddeliveryzoj-3469(区间dp)

FoodDelivery ZOJ-3469 题意:快递员送外卖,n个客户,起始位置为x,速度为v,每个客户单位时间不满意度增加hi,问最少增加多少不满意度。每一个客户可能是从左侧送到或者从右侧送到。1#include<bits/stdc++.h>2usingnamespacest... 查看详情

codevs2800送外卖

【算法】最短路(floyd)&&状态压缩型动态规划(DP)【题解】dp的顺序应该是由含1的个数少的二进制到1的个数高的二进制(第一重循环)#include<cstdio>#include<algorithm>#include<cstring>usingnamespacestd;constintinf=0x3f3f3f3f,maxn=18;intm 查看详情

「codevs」2800送外卖(代码片段)

题意:原题在这快递小哥从city0出发去(n+1)*(n+1)城市矩阵中送快递,求来回最短时间 做法:TSP问题,这里选用dp做法Floyd初始化城市间的距离;令dp[1<<i][i]=dis[0][i]; 表示先走一格,好转移dp[s][j]表示走了j个城市,状态为... 查看详情

状压dp

2800送外卖 时间限制:2s 空间限制:256000KB 题目等级:钻石Diamond题解 查看运行结果 题目描述 Description有一个送外卖的,他手上有n份订单,他要把n份东西,分别送达n个不同的客户的手上。n个不同的客户分别在... 查看详情

「美团codem初赛roundb」送外卖2---------------状压dp(代码片段)

题目描述一张 n 个点 m 条有向边的图上,有 q  个配送需求,需求的描述形式为 (si,ti,li,ri)(s_i,t_i,l_i,r_i)(si?,ti?,li?,ri?),即需要从点 si 送到 ti,在时刻 li 之后(包括 lil_ili?&nbs 查看详情

zoj3469区间dp

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4255这特喵的不就是河南省某届省赛那道开关灯的强化版题目吗。。。。一是数据增强了可能爆int,所以用的LL才A,还有就是给出的坐标不一定有序注意排序,还有起点不一定是送餐点... 查看详情

状压dp送餐员

[odevs2800]送餐员题目描述 Description有一个送外卖的,他手上有n份订单,他要把n份东西,分别送达n个不同的客户的手上。n个不同的客户分别在1~n个编号的城市中。送外卖的从0号城市出发,然后n个城市都要走一次(一个城市... 查看详情

zoj3469fooddelivery(经典区间dp)(代码片段)

...们在送完食物后既可以向前送也可以回头送,这就体现了区间dp的思想为什么我们这次的区间dp不用枚举第三维k来枚举从哪里送过来呢?因为送货员不是傻子,他如果送到你这了,那么在你们两之间的可以都顺路送了,所以我们... 查看详情

[codevs2800]送外卖

[codevs2800]送外卖试题描述有一个送外卖的,他手上有n份订单,他要把n份东西,分别送达n个不同的客户的手上。n个不同的客户分别在1~n个编号的城市中。送外卖的从0号城市出发,然后n个城市都要走一次(一个城市可以走多次)... 查看详情

程序人生干了三年程序员,我决定兼职送外卖

 目  录为什么去送外卖送外卖经历过程送外卖收入状况一些趣事的分享停止送外卖原因送外卖心得感受 写在最后为什么去送外卖当时我的手机只有64GB,但实在太多东西不想清理掉,就想换个最新款的小米手机,256... 查看详情

codevs2800送外卖

题目描述 Description有一个送外卖的,他手上有n份订单,他要把n份东西,分别送达n个不同的客户的手上。n个不同的客户分别在1~n个编号的城市中。送外卖的从0号城市出发,然后n个城市都要走一次(一个城市可以走多次),... 查看详情

[codevs2800]送外卖

题目描述 Description有一个送外卖的,他手上有n份订单,他要把n份东西,分别送达n个不同的客户的手上。n个不同的客户分别在1~n个编号的城市中。送外卖的从0号城市出发,然后n个城市都要走一次(一个城市可以走多次),... 查看详情

codevs2800送外卖

题目描述 Description有一个送外卖的,他手上有n份订单,他要把n份东西,分别送达n个不同的客户的手上。n个不同的客户分别在1~n个编号的城市中。送外卖的从0号城市出发,然后n个城市都要走一次(一个城市可以走多次),... 查看详情

codevs2800送外卖

【算法】状态压缩型动态规划【题解】http://blog.csdn.net/harryguo2012/article/details/42175559(初始不算经过起点1的话,答案就是f[1][(1<<n)-1])先跑一遍floyd后就不用再纠结重复经过的问题了!!!然后就转化为经典状压问题。#include&... 查看详情

外卖人订餐系统定制建设开发,送外卖订餐系统商业运营版源码

外卖人订餐系统定制开发,外卖人订餐系统商业运营版源码,本人承接搭建,安装,二次开发。最新外卖人订餐系统8.5运营版源码,支持PC+WAP+微信订餐开源运营版可二次开发与功能修改。安装说明:服务器空间必须支持PHP+MySQL+... 查看详情

95后程序员月薪2万带着电脑送外卖不想35岁就被社会淘汰你呢(代码片段)

...很多企业公司白领因为经济环境下滑,很多人跑去送外卖去了。外卖这个工作相对来说简单不需要什么技术,只要有辆电动车就可以接单送外卖了。据说送外卖的收入还不低,大城市订单多的话一个月1-2万元甚至更多... 查看详情

我永远不会忘记你,送外卖的好哥哥!

前阵子,一位外卖小哥帮程序员快速改bug的视频,温暖了很多网友的心,于是就有了这篇漫画。<END> 查看详情