Scrambled Letters
의견: 0
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.
Line 1: A single integer N.
Lines 2..1+N: Each of these lines contains the re-ordered name of some cow.
Lines 1..N: Line i should specify, for input string i, the lowest and highest positions in Farmer John's original list the original version of string i could have possibly appeared.
scramble.inscramble.out4
essieb
a
xzy
elsie2 3
1 1
4 4
2 3Output details: "a" appears first no matter what, and "xzy" appears last. "essieb" and "elsie" could each occupy positions 2 or 3.
riseoj 작성
출처 올림피아드 > USACO > 2012-2013 > December > Bronze
평가 및 의견
Scrambled Letters
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Scrambled Letters