You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mycode/ACM/World Finals.py

54 lines
1.0 KiB

from functools import cmp_to_key
c=[[],[]]
string=[[],[]]
for i in range(2):
a = eval(input())
while a>0:
s=input().split()
s[1],s[2]=eval(s[1]),eval(s[2])
c[i].append(s)
string[i].append(s[0])
a-=1
def cmp(a,b):
if a[1]>b[1]:
return -1
elif a[1]==b[1]:
if a[2]<b[2] :
return -1
else:
return 1
else :
return 1
c[0]=sorted(c[0],key=cmp_to_key(cmp))
# print(c[0])
c[1]=sorted(c[1],key=cmp_to_key(cmp))
# print(c[1])
# m='123'
# n='123'
# print(m==n)
st="lzr010506"
s=set(string[0])&set(string[1])
# for i in c[0]:
# for j in c[1]:
# if i[0] == j[0] :
# s.append(j[0])
# print(s)
ans1=0
ans2=0
i=0
while c[0][i][0] != st:
# print(c[0][i][0])
if c[0][i][0] in s:
ans1+=1
i+=1
ans1= i+1-ans1
i=0
while c[1][i][0]!=st:
# print(c[1][i][0])
if c[1][i][0] in s:
ans2+=1
i+=1
ans2=i+1-ans2
# print(ans1,ans2)
print(min(ans1,ans2))
# print(c[0],'\n',c[1])