CodeChef IDE Sucks - Mindflush

One fine evening I was trying to attempt CodeChef Lunchtime Oct 2019. After grueling with pen & paper I decide to code on CodeChef’s IDE.

Question https://www.codechef.com/LTIME77B/problems/BOXGAM97My code is as follows:

# cook your dish here def flip(P): if P == 0: return 1 else: return 0 def rightOrLeft(box, P, pos, N): if P == 1: if pos == 0: return 1 if box[pos - 1] < box[pos + 1]: pos -= 1 else: pos += 1 else: if pos == N - 1: return N - 2 if box[pos - 1] > box[pos + 1]: pos -= 1 else: pos += 1 return pos cases = int(input()) for cas in range(cases): #Code here N, K, P = map(int, input().split()) box = list(map(int, input().split())) if P == 0: pos = box.index(max(box)) elif P == 1: pos = box.index(min(box)) P = flip(P) for b in box: pos = rightOrLeft(box, P, pos, N) P = flip(P) print(box[pos])

Codechef IDE produces error even for demo test case which is

2 4 3 0 4 1 9 5 4 3 1 4 1 9 5

Runs well in geeksforgeeks IDEProof : https://ide.geeksforgeeks.org/LV3Eg8xYqV

Same code on different platforms run differently. So, I tried to run it on my Desktop (Windows 10, Python 3.7.3) and it works like charm.Observe the 9 & 1 in between the inputs. That is the required output for the test case.

C:\Users\pankaj.kum\Desktop>python try.py 2 4 3 0 4 1 9 5 9 4 3 1 4 1 9 5 1

So, to conclude CodeChef has a quite jerky system within. They need to listen to the abuses seriously. Otherwise it will be too late.

P.S GeeksForGeeks, I love you!

Share this:

  • X
  • Facebook
Like Loading...

Related

Tag » Codechef Ide