当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2788:Stock Exchange

题目描述
All stock exchanges in the world have been hit very hardly by the crisis. To keep their profit, they now try to cut down all expenses. Prague Stock Exchange would like to employ new computer software to run their operations.

Will you help them to develop such a system? Your task is to detect all pairs of buyers and sellers that are able to make a deal together.
输入解释
The input contains a description of several issuers. Each of them begins with a line containing an integer N, one space, and a code of the stock issuer. After the first one, there are N other lines, each representing one bid. A bid consists of an agent name, one space character, a word specifying the bid type in lowercase letters (either "buy" or "sell") another space character, and a price given as a decimal number with exactly three digits after the decimal point. All buy bids always specify the maximal price, sell bids list the minimal price for which the agent wants to sell the stocks.

Every issuer code consist of 1-10 uppercase letters ("A" - "Z"). Agent names have at least 1 and at most 20 characters and may be composed of both lowercase and uppercase letters. For one issuer, all agent names are always unique, but the same agents may post bids for several issuers. The number of bids ( N ) will never exceed 1000. No price will be higher than 10000.

The last line of the input contains the string "0 END".
输出解释
For each issuer, print its code on a separate line. Then, for each agent's bid (in the same order they were given in the input), output the name of the agent, a colon (":"), one space, and a list of all agents that are potential counter-parties for the issuer in concern, i.e., one of them wants to buy, the other to sell and the selling price is less or equal to the buying price.

The agent names must be separated by a space and listed in the same order that was used in the input for that issuer. If there is no matching bid, output the string "NO-ONE" instead.
输入样例
3 IBM
OneBuyer buy 10.600
TooExpensive sell 12.000
ThisWillWork sell 10.600
4 ACM
one sell 129.999
two buy 130.000
three buy 131.000
four sell 129.888
4 CVUT
seller sell 121.110
toopoor buy 121.109
sellertwo sell 121.111
iamok buy 121.112
0 END
输出样例
IBM
OneBuyer: ThisWillWork
TooExpensive: NO-ONE
ThisWillWork: OneBuyer
ACM
one: two three
two: one four
three: one four
four: two three
CVUT
seller: iamok
toopoor: NO-ONE
sellertwo: iamok
iamok: seller sellertwo
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 CTU Open 2008

源链接: HDU-2788

最后修改于 2020-10-25T22:56:46+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 32768/32768K(Java/Others)