• [1315] Cost In Land

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • After Wodex getting brave sword, he embarked on a journey of revenge finally.
    But he realized it would be hard to combat Zero. So he needed to expanded his power. How to do it?

    He decided to buy some lands to as his base. The landlord had some lands, each land had its own length and width. The price of each land was its area. But there was a discount. If Wodex bought many lands for only one time, the price would be the maximum of these lands' length multiply the maximum of these lands' width.
    But Wodex was so clever, he would buy all lands for many times to cost less.

    Do you know how to cost less to get all lands? You can not exchange of the land's length and its width.
  • 输入
  • First line contains an integer N (1 <= N <= 5,000) means the number of lands.
    Then N lines follow. Each line contains two integers L(1 <= L <= 1,000,000) and W(1 <= W <= 1,000,000) means the length and width of this land.
  • 输出
  • Output the minimum cost of Wodex.
  • 样例输入
  • 4
    100 1
    15 15
    20 5
    1 100
    0
  • 样例输出
  • 500
  • 提示
  • 来源
  • Hungar
  • 操作

显示春菜