hdu 1897 SnowWolf's Wine Shop multiset 运用 STL
2012-09-05 20:00
211 查看
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
[align=left]Problem Description[/align]
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.
[align=left]Input[/align]
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
[align=left]Output[/align]
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.
[align=left]Sample Input[/align]
2
2 3 3
2 3
1 2 3
2 3 0
2 3
3 1 2
[align=left]Sample Output[/align]
Case 1:
2
3
-1
Case 2:
3
-1
2
[align=left]Author[/align]
Sempr|CrazyBird|hust07p43
[align=left]Source[/align]
HDU 2008-4 Programming Contest
题意:
有价格不同的酒 输入n m y 表示n瓶酒 每瓶酒都有特定度数
然后输入m个询问 表示 m个人 要买m瓶酒 如果没有那个人买的度数为k的酒 就给他度数为k+1到k+y的酒
如果也没有 就输出-1
思路:
用multiset搞定
相关文章推荐
- HDU 4287 Intelligent IME(STL 映射map的运用)
- HDU 1247 Hat’s Words(map,STL,字符处理,string运用)
- hdu 4941 Magical Forest(STL map & 结构体运用)
- STL : map函数的运用 --- hdu 4941 : Magical Forest
- STL : map函数的运用 --- hdu 4941 : Magical Forest
- hdu1702-简单stl运用
- HDU 5058 So easy(STL 集合set的运用)
- hdu 1238 字符串的简单运用
- ACM练级日志:HDU 4286 STL-双端队列 以及Presentaion Error
- STL之二分查找:hdu 5178 ( BestCoder Round #31 1001 )
- STL运用的C++技术(5)——重载操作符
- HDU1263_水果_stl的map的嵌套用法
- POJ 3481 & HDU 1908 Double Queue (map运用)
- hdu 2072 找单词 很不错的一道题 模拟 and STL 2种做法
- STL 六大组件 功能与运用
- hdu 5210 hash统计或stl
- HDU 5349 MZL's simple problem (STL 优先队列)
- UVa 443 / POJ 2247 Humble Numbers (4因子-丑数&STL灵活运用)
- 运用STL快速得到枚举排列
- Hdu--1556--Color the ball(树状数组最简单运用)