UESTC 482 Charitable Exchange(优先队列+bfs)
Charitable Exchange
Time Limit: 4000/2000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)
Status
Have you ever heard a star charity show called Charitable Exchange? In this show, a famous star starts with a small item which values 11 yuan.
Then, through the efforts of repeatedly exchanges which continuously increase the value of item in hand, he (she) finally brings back a valuable item and donates it to the needy.
In each exchange, one can exchange for an item of Vi yuan if he (she) has an item values more than or equal to RiRi yuan,
with a time cost of TiTi minutes.
Now, you task is help the star to exchange for an item which values more than or equal to MM yuan
with the minimum time.
Input
The first line of the input is TT (no
more than 2020),
which stands for the number of test cases you need to solve.
For each case, two integers NN, MM (1≤N≤1051≤N≤105, 1≤M≤1091≤M≤109)
in the first line indicates the number of available exchanges and the expected value of final item. Then NN lines
follow, each line describes an exchange with 33 integers ViVi, RiRi, TiTi (1≤Ri≤Vi≤1091≤Ri≤Vi≤109, 1≤Ti≤1091≤Ti≤109).
Output
For every test case, you should output Case
first, where kk indicates
#k:
the case number and counts from 11.
Then output the minimum time. Output −1−1 if
no solution can be found.
Sample input and output
Sample Input | Sample Output |
---|---|
3 优先队列 贪心+bfs #include <iostream> #include <string.h> |
Case #1: -1 |
最新文章
- ActiveMQ中的Destination高级特性(一)
- es6 Class的继承extends &; super
- R语言数据的输入
- Information retrieval信息检索
- Linux下好玩的命令
- LingPipe-TextClassification(文本分类)
- 【数学/扩展欧几里得/线性求逆元】[Sdoi2008]沙拉公主的困惑
- FastScroll(1)ListView打开FastScroll及自定义它的样式
- Gitolite轻松部署/管理git server
- 微信内移动前端开发抓包调试工具fiddler使用教程
- Java I/O之NIO Socket
- #pta循环作业
- H5 仿ios select滚动选择器。框架。
- 使用catboost解决ML中高维度不平衡数据集挑战的解决方案
- spring boot 配置注入
- JavaSE回顾及巩固的自学之路(四)——————方法和数组,面向对象
- Jquert data方法获取不到数据,显示为undefined。
- Audition CS6在Win 7中“音频输入的采样频率与输出设备不匹配”问题的解决 - imsoft.cnblogs
- cobbler 自定义安装系统
- 《Head First 设计模式》读书笔记