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

Discussion of Problem 1523. K-inversions

Roman Nefyodov [Ufa SATU] WA4 [4] // Problem 1523. K-inversions 20 Feb 2007 19:14
What in this test?
I use AVL trees and calculate result with binomial coefficient's. Where i mistaken?
Anton juver++ Postnikov Re: WA4 [3] // Problem 1523. K-inversions 20 Feb 2007 21:12
Interval tree is enough.
I wrote solution based on binomial coefficient's, but it's almost wrong(WA 9).
My new program, DP O(n * k * logn ) gets AC.

Edited by author 20.02.2007 21:23

Edited by author 20.02.2007 21:23
Lomir Re: WA4 [2] // Problem 1523. K-inversions 13 Oct 2007 04:01
I used direct calculation of bin cofficents from factorials.

Answer := SUM[ C(k - 1)(n) ]   for each ai
where n is the number elements greater tha ai in subsequance from 0 till ai.

However also WA4... Why?
SerailHydra Re: WA4 // Problem 1523. K-inversions 2 Mar 2008 08:26
Try this test:

Input:
6 3
6 2 3 1 5 4

Output:
3
elmariachi1414 (TNU) Re: WA4 // Problem 1523. K-inversions 7 Nov 2008 16:28
Also test
5 3
5 2 1 4 3
breaks this approach