Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions College Admissions.py/College Admissions .py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# cook your dish here

# cook your dish here



for i in range(int(input())):



u, p = map(int,input().split())

cR = list(map(int,input().split()))

sRank = list(map(int,input().split()))

student=[]

for i in range(p):

c = list(map(int, input().split()))

_c = sorted(c[1:], key=lambda u: cR[u-1])

student.append([i, c[0], _c])

sort_stu= sorted(student, key= lambda u: sRank[u[0]])



cls_filed = [False] * u

cho = 0

for i in sort_stu:

ch = 0

for j in i[2]:

if(cls_filed[j-1] == False):

cls_filed[j-1] = True

ch = j

break

if(i[0] == 0):

cho = ch

break



print(cho)