# | User | Rating |
---|---|---|
1 | ecnerwala | 3648 |
2 | Benq | 3580 |
3 | orzdevinwang | 3570 |
4 | cnnfls_csy | 3569 |
5 | Geothermal | 3568 |
6 | tourist | 3565 |
7 | maroonrk | 3530 |
8 | Radewoosh | 3520 |
9 | Um_nik | 3481 |
10 | jiangly | 3467 |
# | User | Contrib. |
---|---|---|
1 | maomao90 | 174 |
2 | adamant | 164 |
2 | awoo | 164 |
4 | TheScrasse | 160 |
5 | nor | 159 |
6 | maroonrk | 156 |
7 | -is-this-fft- | 150 |
8 | SecondThread | 148 |
9 | pajenegod | 145 |
9 | orz | 145 |
Name |
---|
That's a fairly standard problem on BIT (binary indexed tree).
Let the position of the x-th router and the y-th router be i and j. And the position of the x-th and y-th contestant be i2 j2.
The two lines can only intersect in two cases:
Counting these pairs are standard problem and tutorials can be found throughout the internet, so i won't state it here
Sorry for bad English
So i just count all pair that is intersect with curreent pair in O(1)?
I think the counting of the pairs can only be done in O(log n) with BIT or seg tree given that there is update
I have senior that solve this problem during contest, he said he used LIS or LCS to solve this problem.. did u agree?
I agree, the concept lies below is the same
Actually there is a similar problem on CF https://codeforces.com/gym/227122/problem/C
The following is my solution (C++)