1430C — Numbers on Whiteboard #python #pypy

Правка en1, от gokulraaj59, 2022-08-26 08:53:54

my code 169668033

getting TLE in test 2, have used fast_IO and verified this time complexity with solution solution blogalso.. have used same logic

what I am doing wrong here..


def remove(arr, ele): arr.remove(ele) return arr t = int(input()) for _ in range(0, t): n = int(input()) a = [] op = [] for i in range(1, n+1): a.append(i) # print(a) for i in range(0, n-1): # a.sort() x = a[-1] y = a[-2] a.append(round( (x+y)/2) ) op.append([x,y]) a = remove(a, x) a = remove(a, y) sys.stdout.write(str(a[0]) + "\n") for i in op: sys.stdout.write(" ".join(map(str,i)) + "\n")

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский gokulraaj59 2022-08-26 08:53:54 866 Initial revision (published)