Farmer John keeps an alphabetically-ordered list of his N cows (1
Farmer John keeps an alphabetically-ordered list of his N cows (1 <= N <= 50,000) taped to the barn door. Each cow name is represented by a distinct string of between 1 and 20 lower-case characters. Always the troublemaker, Bessie the cow alters the list by re-ordering the cows on the list. In addition, she also scrambles the letters in each cow's name. Given this modified list, please help Farmer John compute, for each entry in the list, the lowest and highest positions at which it could have possibly appeared in the original list.
标签: HBC24372求逆序数 数据结构 树状数组 排序[USACO 2012 Dec B]Scrambled Letters题解