Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

题意+思路

Posted by 2008022118 at 2010-03-02 21:11:02 on Problem 1794
题意:求逆序数;分三段——1.前n个是一个整体;2.后m个是一个整体;3.n+m合并后;
因为blue和red自己队里的不会相交,所以用3的逆序数减去1和2的逆序数;

先对第1部分排序,求其逆序数;在对2 排序求其逆序数;n+m全部排序求逆序数;
y排序,x求逆序数;
y按升序排序,当y相等时,按x降序排,为什么呢?
因为当j==l时;不管i<k或i>k都要算一次,所以大的在前。

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator