Chef and proxy problem

Hi!
I am just a rookie programmer.I am getting NZEC error E0F in python 3.6
while taking input but it works fine for custom input and in my IDE
It goes like this
t=input()
thanks in advance.

2 Likes

It will be more helpful if you send the code and some sample inputs, because there might be some errors in your code

@deadshot_sb @ut3698 Wait for the contest to over.

1 Like

oops i forgot about the contest ongoing. Thanks for reminding.

t=int(input())
for j in range(t):
d=int(input())
s=input()
c=0
n=0
for i in range(d):
if s[i]==“P”:
c=c+1
u=(c/d)*100
if u>=75:
print(0)
break
for i in range(d-1):
if s[i]==“A” and i>2 and i<=d-3:
if (s[i-2:i]==“PP”) and (s[i+1]==“P” or s[i+2]==“P”):
n=n+1
c=c+n
u=(c/d)*100
if u>=75:
print(n)
break
else:
pass
if u<75:
print(-1)
break

Firstly, am assuming that you have marked the identations correctly.

I did not find any NZEC error in your code

But it will provide you a WA because in the problem it is clearly mentioned that in d-1 or in d-2 at least in one day Chef should be present but you are checking for both, so similarly there should also be a change in checking of ith position of the string after the 2nd inner loop(i>=2)

You are updating variable c after every check and also n . (Think about that)

you should add up the number of days in which you can mark him present to initial once not after every calculation of the increment.

Lastly, when you are printing -1 at last, you are breaking out of the test case loop, which will terminate the test cases succeeding any negative response case.

Thank you.

i was getting one when i was runnning it on ide bcz i was not aware that we need to provide custom input in that case.So sorry and thanks.And about c, i am checking when it crosses the 75 mark so that i dont need to check for minm later but thanks for help and suugestions @deadshot_sb

@ut3698 I guess these were the only mistakes and yes that’s a problem for Java and python users when given no input results in a runtime error.