You are viewing a single comment's thread. Return to all comments →
My Soln:
from math import ceil T = int(input()) my_list = [] for _ in range(T*2): my_list.append(list(map(int, input().split())))
new_list = []
for i in range(1,len(my_list),2): new_list.append(my_list[i])
for j in range(0,len(new_list)): for k in range(0,ceil(len(new_list[j])/3)): if ( (new_list[j][k + 1] <= new_list[j][len(new_list[j]) - (k + 1)] and new_list[j][len(new_list[j]) - (k + 2)] <= new_list[j][len(new_list[j]) - (k + 1)]) or (new_list[j][k + 1] <= new_list[j][k] and new_list[j][len(new_list[j]) - (k + 2)] <= new_list[j][k])): passed_all = True
else: print("No") passed_all = False break if passed_all == True: print("Yes")
Seems like cookies are disabled on this browser, please enable them to open this website
Piling Up!
You are viewing a single comment's thread. Return to all comments →
My Soln:
from math import ceil T = int(input()) my_list = [] for _ in range(T*2): my_list.append(list(map(int, input().split())))
new_list = []
for i in range(1,len(my_list),2): new_list.append(my_list[i])
for j in range(0,len(new_list)): for k in range(0,ceil(len(new_list[j])/3)): if ( (new_list[j][k + 1] <= new_list[j][len(new_list[j]) - (k + 1)] and new_list[j][len(new_list[j]) - (k + 2)] <= new_list[j][len(new_list[j]) - (k + 1)]) or (new_list[j][k + 1] <= new_list[j][k] and new_list[j][len(new_list[j]) - (k + 2)] <= new_list[j][k])): passed_all = True