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.
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.
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.
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!
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%
Please format your code properly using the </> button in the toolbar for others to examine your code.
I understood the description and for me the validators worked.
I liked this puzzle!
Thank you!
Thank you.
The validators don’t test for branching paths. Hope it saves some effort.
Tests provided in the IDE have been successfully passed, but when I submitted the solution Validator 3, Validator 4 and Validator 5 fail. Why ?
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.
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.
i don’t understand
First, you copy and paste your code. Then you highlight all of it. And then you click the </> button in the toolbar (see screenshot below). Your code should then be formatted and shown properly in this forum.
Hello, same for me and I don’t understand your answer. Is it possible to update the test cases please?
My code below if you want to have a look:
[Mod edit: Please avoid posting codes on the forum.]
I’ve run your code on the validators. The error is (for all the last three validators):
Process has timed out. This may mean that your solution is not optimized enough to handle some cases.
The issue is that the while loop never breaks.
Really good puzzle, loved solving it.
I didn’t have much experience in recursive function and I learned a lot.
However, I think I struggled for nothing while making a function that uses the list of all the indices of the 'a’s instead of doing 1 by 1 by browsing the array but i sill managed to do it like this
All tests passed. Validator3, Validator4, Validator5 not passed ! Have no idea why. Please check validators or put one of them to tests. Here is my code.
[Mod edit: Please avoid posting codes on the forum.]
Hi,
Validator3, Validator4 & Validator5 are failing because it’s timing out with your code, you need to optimize it.
Thank you. I did foolish mistake and got circle loop in some cases.