Alien DictionaryProblem code: PGM6 |
All submissions for this problem are available.
Some alien civilization has a quite strange language. Each word has length wordLength and consists of only 'A' and 'B' characters. Some sequences of A's and B's are forbidden (by ancient tradition), and do not appear as a substring of any valid word. Any word that does not contain a forbidden substring is valid. The set of forbidden substrings is given in the String[] forbiddenSubstrings. Each element of forbiddenSubstrings contains 'A' or 'B' .
The alien dictionary contains all valid alien words in alphabetical order. Each page of the dictionary contains exactly one word. Pages are numbered starting from 0. Given a int[] wordNumbers, return a String[] containing the same number of elements as wordNumbers, where the i-th element is the word written on page wordNumbers[i] of the dictionary or "NO PAGE" (quotes for clarity) if there is no such page in the dictionary.
Input
The first line consists of the number of characters. This is followed by the list of forbidden substrings separated by space. The last line consists of the page numbers to be displayed.
Output
List of words in the specified pages as specified in the problem statement. NO PAGE if there is no page.
Example
Input:
5
AAA BAA ABB
4 12 0 6 9
Output:
{BBBAB,NO PAGE,AABAB,BBBBB,NO PAGE}
| Author: | mariojuana |
| Date Added: | 27-02-2010 |
| Time Limit: | 1 - 5 sec |
| Source Limit: | 50000 Bytes |
| Languages: | C |
Comments
SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:
HELP
Program should read from standard input and write to standard output. After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:
- Accepted
Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark. - Time Limit Exceeded
Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach. - Wrong Answer
Your program compiled and ran succesfully but the output did not match the expected output. - Runtime Error
Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section. - Compilation Error
Your code was unable to compile. When you see this icon, click on it for more information.
If you are still having problems, see a sample solution here.

Fetching successful submissions

my solution is showing time
my solution is showing time exceeded but it is not showing by how much it is exceeding. So is there there any way to know that by how much time it is exceeding so that i can increase the efficiency of my program. Any information will be helpful. Thanks.
I don't want to be a sore