[Community Puzzle] abcdefghijklmnopqrstuvwxyz

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @renzyGo,validated by @FredericLocquet,@Regulus136 and @field3.
If you have any issues, feel free to ping them.

This was very challenging, and I enjoyed and learned; very easy to understand the goal.
And I LOVE the title of the challenge. Hilarious. Thanks!

I noticed you don’t have a “Test5”… It goes from “Test 4” to “Test 6” which definitely seems odd, so just letting you know that if you want to change it.

3 Likes

Thank you.
I fixed the title in the test case.
I didn’t notice the mistakes in the title of the test case at all.
Thank you for your advice.

2 Likes

Nice puzzle!
I spend 5 minutes debugging my solution only to find that I spelled the alphabet wrong… Gotta go back to learn the classics I guess!

1 Like

I had all the test cases right but still got 80% because of the validators at test case 4,
why?
n = int(input())

p = []

q = []

for i in range(n):

p += [list(input())]

for i in range(n):

q += [[]]

for _ in range(n):

    q[-1] += ['-']

for i in range(n):

o = ord('a')

for j in range(len(p[i])):

    if ord(p[i][j]) == o:

        a,b = i,p[i].index(p[i][j])

        while True:

            q[a][b] = chr(o)

            o += 1

            c = p[min(a+1,n-1)][b]

            d = p[a][min(b+1,n-1)]

            e = p[a][min(b-1,n-1)]

            f = p[min(a-1,n-1)][b]

           

            if ord('z') == o-1:break

            if ord(c) == o : a+=1

            elif ord(d) == o : b+=1

            elif ord(e) == o : b-=1

            elif ord(f) == o: a-=1

            else:

                q = []

                for s in range(n):

                    q += [[]]

                    for _ in range(n):

                        q[-1] += ['-']

                o = ord('a')

                p[i][p[i].index(chr(o))] = '.'

                if chr(o) not in p[i]:

                    break          

                b += 1

        if ord('z') == o-1:

            for i in q:

                print(''.join(i))

            quit()

this is my solution and I don’t get why i didn’t get the 100%

1 Like

Please format your code properly using the </> button in the toolbar for others to examine your code.

1 Like

I understood the description and for me the validators worked.
I liked this puzzle!

Thank you! :slight_smile:

1 Like

Thank you.

The validators don’t test for branching paths. Hope it saves some effort.

2 Likes

Tests provided in the IDE have been successfully passed, but when I submitted the solution Validator 3, Validator 4 and Validator 5 fail. Why ?

1 Like

Yeah, knowing this makes solving it a little easier, since there is no need to come back upstream if a branch ends prematurely. I’d also argue that this makes the labels of BFS and DFS not 100% correct. Maybe there could be (or is already) a harder version of this which accounts for branching.

Still a fun puzzle to solve.

3 Likes

Thank you.
I’m not sure if this will be helpful or not, but let me write a comment.
If you find the letter a, look up, down, left, and right to find b. Continue to search for the next character and examine up, down, left, and right. I think that this solution can solve the problem of this program (includes validation 3, 4, 5). Thanks.

1 Like

(post deleted by author)