ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

Please, help to solve a problem...
Posted by Sergey 3 Nov 2006 10:13
Please, explain how to solve this problem, or give a link where solution is described.
Task:
Given a sequence of N integer numbers (say a array), it is necessary for each position i find amount of such j, that: (i<j) and (a[i]>a[j]).
For example:
input:
4 6 10 3 7 1 9 2 15 5 8
output:
3 4 7 2 3 0 3 0 2 0 0
Re: Please, help to solve a problem...
Posted by Anton [SUrSU] 3 Nov 2006 11:52
You may use the idea of merge sort as for counting amount of inversions.
Re: Please, help to solve a problem...
Posted by Sergey 3 Nov 2006 13:44
Thanks! I will try to solve this way.