The Legend Lives On!Problem code: KC204 |
All submissions for this problem are available.
Points:10
Your college teacher was highly impressed by your previous achievement. So now he has given you a new project to work on. If you can make this one into a success, you could be on your way to Rio de Janeiro in Brazil to participate in the global finale of this international technical extravaganza sponsored by Bromhood Brothers, a leading software developer( Now why does it look familiar ?!?). You are given set of letters, and the challenge is to find how many different words can be made from these letters. This problem is designed to take all the fun out of it by automating the process.
Input:
Input will be in two parts. The first part will be a dictionary of less than
1000 lines, containing words to be searched for. Each line will contain one
word of up to 7 characters. Each word will be in lower case. The words will
be in alphabetical order. The end of the dictionary will be indicated by a
line consisting of a single #' character.
After the dictionary there will be data for several word puzzles, each on a
separate line. Each puzzle line will have from one to 7 lower case letters,
separated by one or more spaces. Your task is to arrange some or all of
these letters to form words in the dictionary. The list of puzzles will be
terminated by a line consisting of a single #'.
Output:
For each puzzle line in the input, a single line of output should be
produced, containing the number of different words in the dictionary that
can be formed using the letters in the puzzle line.
Note that each letter may be used only as many times as it appears in the
puzzle line. For instance, the puzzle line u l l' may produce the word lul'
but not the word lull'.
Example:
Input:ant bee cat dog ewe fly gnu # b e w b b e e w w t a n c u g d #Output:
0 2 3
| Author: | ankitbabbar |
| Date Added: | 16-10-2009 |
| Time Limit: | 5 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TEXT, WSPC |
Comments

Fetching successful submissions

Could you please check the
Could you please check the input / output . I have checked my algorithm a number of times and don't see a bug in it .
The input and output cases
The input and output cases are correct and there are no capital letters..
there seems to be some wrong
there seems to be some wrong case in this problem, am sure of it!!!
The i/o cases are
The i/o cases are correct...and there are correct submissions too..
What is the number of word
What is the number of word puzzles that will be given at max?
The max no of word puzzles
The max no of word puzzles can be 50
Based on a number of
Based on a number of observations I can guarantee that there is something wrong with your input format. Taking input via 2 different formats - one of them causes a TLE, the other causes a wrong answer to be produced in 0.0 seconds. As the core algo is the same, this is inconsistent. Please re-check your input format. The values might be correct but the format might not.
my code is running perfectly
my code is running perfectly in my machine...it is giving (run time error)seg fault in online judge, cant understand y.
plz help
@ Bharat: The input format
@ Bharat: The input format and the test cases ate both correct..and there are already correct submissions for the same...
@ anshul: Segmentation fault
@ anshul: Segmentation fault error occurs when there are some wrong memory access procedures in your program
Can u tell me all the cases
Can u tell me all the cases wen your compiler shows a run time error
and can i use string functions, do while loops
I do not find any reason why it is showing no error in my machine, but your compiler says "RUN TIME ERROR", even though I have checked for more than 1000 word lines (as specified in the problem)
@anshul: You can check the
@anshul: You can check the details at www.codechef.com/wiki
can you give some other test
can you give some other test case.
@mohit: The test cases
@mohit: The test cases provided are enough...