DCP-328: Reconstructing Blue Print of Life

Dev Skill archived problems can be discussed here.

DCP-328: Reconstructing Blue Print of Life

by Bruteforceman » Tue May 30, 2017 12:58 pm

Can I have some test cases on this problem? I was pretty sure that my solution was correct during the contest, but got WA :(
here's my code: https://code.hackerearth.com/441ba5D
 
Posts: 1
Joined: Tue May 30, 2017 12:35 pm

Re: DCP-328: Reconstructing Blue Print of Life

by BishalG » Tue May 30, 2017 2:14 pm

You may try case:
1
10 2 1 8
asdasdaaaa

Judge's output is: 11 whereas your code produce 12.
User avatar
 
Posts: 43
Joined: Tue Jan 17, 2017 10:10 pm

Re: DCP-328: Reconstructing Blue Print of Life

by BishalG » Tue May 30, 2017 8:11 pm

Explanation from Problem Setter:
Considering case
10 2 1 8
asdasdaaaa
First consider empty string "" adding "a" results "a" with cost 2
Then adding "s" to string "a" results "as" with cost 2+2
Then adding "d" to string "as" results "asd" with cost 2+2+2
Then adding "as" to string "asd" results "asdas" with cost 2+2+2+1
Then adding "da" to string "asdas" results "asdasda" with cost 2 + 2 + 2 + 1 + 1
Then adding "a" to the string "asdasda" results "asdasdaa" with cost 2 + 2 + 2 + 1 + 1 + 2
Then adding "aa" to the string "asdasdaa" results "asdasdaaaa" with cost 2 + 2 + 2 + 1 + 1 + 2 + 1

That results in total cost of 11. Hope that suffice. Happy coding. :)
User avatar
 
Posts: 43
Joined: Tue Jan 17, 2017 10:10 pm


Who is online
Users browsing this forum: No registered users and 1 guest
cron