Hello I am a beginner andwas solving a google kickstart problem Round B 2020 and the result is perfectly coming in my pycharm editor. But it is not accepted by the online judge, Please can someone help, anyone with experience/pro level coders in competitive coding.
Here is the link of the problem: https://codingcompetitions.withgoogle.com/kickstart/round/000000000019ffc8/00000000002d82e6
Below is my code:
def checkpointsinput(number: int, c:int):
checkpoint_height = list(map(int,input().split()))
if len(checkpoint_height)>=3 and len(checkpoint_height)<=100:
tour(checkpoint_height, c)
def tour(checkpoints, caseno:int):
peak = 0
count = 0
for i in range(len(checkpoints)):
if i != 0 and i != len(checkpoints)-1:
if checkpoints[i]>=1 and checkpoints[i]<=100:
if checkpoints[i] > checkpoints[i - 1] and checkpoints[i] > checkpoints[i + 1]:
temp = checkpoints[i]
if temp == peak:
count = count + 1
if temp > peak:
count = 1
peak = temp
print('Case #' + str(caseno+1) + ': ' + str(count),flush=True)
def main():
cases = int(input())
if cases <= 100 and cases > 0 :
for i in range(cases):
Checkpoints = int(input())
if (Checkpoints>=3 and Checkpoints<=100):
checkpointsinput(Checkpoints, i)
if __name__== "__main__" :
main()