Please read the new rule regarding the restriction on the use of AI tools. ×

Run Time Error

Revision en1, by MahmoudElShaer, 2021-05-03 17:47:08

I'm new to problem-solving, I begin with python but my submission keeps show run time error also it runs very well on Terminal this the problem link

and this my code

import numpy as np

def input_func(): return list(map(int, input().split()))

def cum_sum(gold_array): return np.cumsum(gold_array)

def re_arrange(gold_array): np.random.shuffle(gold_array) return cum_sum(gold_array)

for _ in range(num_cases): _, x = input_func() gold_array = np.array(input_func())

for i in range(num_cases): if x not in cum_sum(gold_array): print("YES") print(*gold_array) elif True: flag = 10 while flag > 0 : if x not in re_arrange(gold_array): print("YES") print(*gold_array) break flag -= 1 else: print("NO")

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English MahmoudElShaer 2021-05-03 17:48:53 18
en1 English MahmoudElShaer 2021-05-03 17:47:08 965 Initial revision (published)