Farewell Round A 2023. Task 1
Python Only
T=int(input())
letters='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for t in range(T):
D=input().replace(' ','')
N=int(input())
numbers=set()
words=set()
for i in range(N):
w=input()
words.update([w])
n=''.join([D[letters.find(s)] for s in w])
numbers.update([n])
if len(numbers) < len(words):
print('Case #{}: YES'.format(t+1))
else:
print('Case #{}: NO'.format(t+1))
xxxxxxxxxx
def colliding_encoding(
T=selector([1,2],default=1,label='$\\mathbb{T}$'),
D=input_box('0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n'+\
'0 1 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3',
type=str,label='$\\mathbb{D}$',width=50,height=3),
N=input_box('4|3',type=str,label='$\\mathbb{N}$',width=50),
W=input_box('ABC BC BCD CDE|CDE DEF EFG',
type=str,label='$\\mathbb{W}$',width=50)):
letters='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
numbers=set(); words=set()
DS=str(D).split('\n')[T-1]
DS=DS.replace(' ','')
N=int(str(N).split('|')[T-1])
WS=(str(W).split('|')[T-1]).split()
pretty_print([T,DS,N,WS])
for i in range(N):
w=WS[i]
words.update([w])
n=''.join([DS[letters.find(s)] for s in w])
numbers.update([n])
if len(numbers) < len(words):
pretty_print('Case #{}: YES'.format(T))
else:
pretty_print('Case #{}: NO'.format(T))
No comments:
Post a Comment