hdu 1897 SnowWolf's Wine Shop multiset 运用 STL
来源:互联网 发布:3d动漫设计软件 编辑:程序博客网 时间:2024/05/16 04:54
SnowWolf's Wine Shop
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 10240/10240 K (Java/Others)Total Submission(s): 197 Accepted Submission(s): 77
Problem Description
After retired from hustacm, Sempr(Liangjing Wang) find a part-time-job in Snowwolf(Wei Xu)'s wine shop. There are different qualities of wine in the shop, and all of which has a rating describing the qualities. All the ratings are larger than 0 and smaller than 1,000,000. Everyday nearly Q people will go to his shop and buy a bottle of wine because of his kindness. Once a customer want an X qualified rating but there are no such one, Sempr will sell him a better one with the smallest rating. But the boss of the shop is Snowwolf, you know, so if no wine has no more than Y qualified ratings better than the customer's request, Sempr will say sorry to them. Every morning, Xiangsanzi will send N bottles of different or same qualified wine.
Input
In the first line there is an Integer T(0<T<10), which means the number of test cases in the test file, then followed by T test cases.
For each test case;
In the first line, there are 3 Integers, N,Q and Y.
In the second line, there are N integers, which means the quality rating of each bottle of wines.
In the third line, there are Q integers, which means the requests of customers from dawn to dark.
Here, all the Integers are between 0 and 1,000,000
For each test case;
In the first line, there are 3 Integers, N,Q and Y.
In the second line, there are N integers, which means the quality rating of each bottle of wines.
In the third line, there are Q integers, which means the requests of customers from dawn to dark.
Here, all the Integers are between 0 and 1,000,000
Output
For each test case, output "Case I:", where I is the case number, then followed by Q different lines of integers, means the quality of wine Sempr will sell that time. If he could not sell any wine, just output -1.
Sample Input
22 3 32 31 2 32 3 02 33 1 2
Sample Output
Case 1:23-1Case 2:3-12
Author
Sempr|CrazyBird|hust07p43
Source
HDU 2008-4 Programming Contest
题意:
有价格不同的酒 输入n m y 表示n瓶酒 每瓶酒都有特定度数
然后输入m个询问 表示 m个人 要买m瓶酒 如果没有那个人买的度数为k的酒 就给他度数为k+1到k+y的酒
如果也没有 就输出-1
思路:
用multiset搞定
- hdu 1897 SnowWolf's Wine Shop multiset 运用 STL
- hdoj1897 SnowWolf's Wine Shop (multiset)
- hdu 4302 STL multiset
- multiset运用 HDU 1540 Tunnel Warfare
- HDU Bombing (STL multiset+map)
- hdu 4631 Sad Love Story (STL+multiset)
- HDU 4122 Alice's mooncake shop
- HDU TIANKENG’s rice shop(模拟)
- hdu 4884 TIANKENG’s rice shop(模拟)
- hdu 4884 TIANKENG’s rice shop(模拟)
- HDU-4884-TIANKENG’s rice shop
- HDU 4122 Alice's mooncake shop
- Hdu 4122 Alice's mooncake shop
- hdu 4122 Alice's mooncake shop题解
- HDU-4884-TIANKENG’s rice shop【模拟】
- hdu--4884--TIANKENG’s rice shop【模拟】
- 【multiset】hdu 5349 MZL's simple problem
- STL MultiSet
- Linux内核和用户空间通信的方法— 使用netlink (续)
- Hook IDirect3DDevice9::Present
- TESTNG--Introduction 笔记2012-9-5
- HDOJ 1234 开门人和关门人(水题)
- 安装hadoop和gluster
- hdu 1897 SnowWolf's Wine Shop multiset 运用 STL
- QiuQiu大事件
- 退出应用程序杀死进程
- C++默认构造函数——深入理解
- Spring中bean的初始化和销毁之前的方法XML和注解的两种形式
- 对MySQL load data infile的一点想法
- 使用system.out.println输出类名问题
- [init.rc] android init.rc 总结
- Oracle SOA Suite 学习笔记(一)