P6093 [JSOI2015] Nesting Dolls.
Background
JYY has just returned from a trip to Russia and bought a lot of beautiful nesting dolls as souvenirs. Because JYY was too excited, he opened all of the nesting dolls. Since many of the dolls look very similar, JYY now does not know how to put them back (he really cannot figure out which doll should be put into which).
Description
JYY has a total of $N$ disassembled nesting dolls, numbered from $1$ to $N$. Doll $i$ has an outer diameter $Out_i$ and an inner diameter $In_i$ ($In_i
Input Format
The first line contains a positive integer $N$. The next $N$ lines each contain three positive integers $Out_i,In_i,B_i$, representing the outer diameter, inner diameter, and beauty value of doll $i$.
Output Format
Output one integer in a single line, representing the minimum possible dissatisfaction.
Explanation/Hint
For $100\%$ of the testdata, $N\leq 2\times 10^5$, $1\leq In_i