Skip to content

Instantly share code, notes, and snippets.

@atul-chaudhary
Created September 14, 2019 02:43
Show Gist options
  • Save atul-chaudhary/2911cd787ca459099c7f23690bceb7a9 to your computer and use it in GitHub Desktop.
Save atul-chaudhary/2911cd787ca459099c7f23690bceb7a9 to your computer and use it in GitHub Desktop.
traveloka : programming Question
1
10
A 10
A 15
A 20
I 10
A 22
D 5
A 27
P 3
P 2
P 5
#here is the program
t=int(input())
for _ in range(t):
q=int(input())
lst_re=[]
lst_re1=[]
l=len(lst_re)
for _ in range(q):
lst=input().split()
print(lst)
if(lst[0]=='A'):
lst_re.append(int(lst[1]))
elif(lst[0]=='I'):
for i in range(len(lst_re)):
lst_re[i]+=int(lst[1])
elif(lst[0]=='D'):
for i in range(len(lst_re)):
lst_re[i]-=int(lst[1])
elif(lst[0]=='P'):
lst_sor=sorted(lst_re,reverse=True)
lst_re1.append(lst_sor[int(lst[1])-1])
for j in range(len(lst_re1)):
print(lst_re1[j])
lst_re.clear()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment