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

建议使用的浏览器:

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

3598:PopKart

题目描述

Xiao Feng is a big fan of the online multiplayer racing game PopKart. Among various types of play, Xiao Feng prefers the Speed Game, in which players compete to be the fastest racer. In order to win the races, apart from solid driving skills, the player must also own a top-class kart. Results of races among experienced players are mostly decided by the karts which they ride.

Now a new generation of karts has hit the market. Xiao Feng wants to purchase one of them. Two factors prevents him from going straightly for the best ones. First, the available (virtual) funds are limited. Second and more importantly, it is a non-trivial task to decide which karts are the best.

To find out the best karts that he can afford, Xiao Feng employs a simple scheme to classify the karts by their performance.

The performance of a kart is characterized by two parameters—the straight-line speed v and the drift speed w. A kart is said to be superior to another if and only if it is superior in either speed and not inferior in the other. All karts to which no other karts are superior are classified as karts of class 1. For each m ≥ 2, all karts to which only karts of classes 1 through m − 1 are superior are classified as karts of class m.

Given the straight-line and drift speeds of n karts, classify them as specified above.

输入解释

The input contains a single test case. The first line contains n (1 ≤ n ≤ 105). The remaining n lines each contain two integers v and w (0 ≤ v, w < 106), the straight-line and drift speeds of a kart.

输出解释

For each class in increasing order of m, print a list of karts of that class using the format

k: (v1,w1) (v2,w2) (vk,wk)

where k is the number of karts of that class, and (v1, w1), (v2, w2), …, (vk, wk) are their straight-line and drift speeds. The k pairs of speeds shall be sorted so that vi < vj ∨ (vi = vjwiwj) for any 1 ≤ i < jk (“∨” and “∧” represent logical OR and AND, respectively).

输入样例
4
1 2
2 1
2 3
3 2
输出样例
2: (2,3) (3,2)
2: (1,2) (2,1)

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-3598

最后修改于 2020-10-29T07:05:42+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
5000 131072