Submission #81849

#TimeUsernameProblemLanguageResultExecution timeMemory
81849tnbs10Zamjena (COCI18_zamjena)Cpython 3
14 / 70
48 ms4976 KiB
n = int(input()) a = list(map(str, input().split())) b = list(map(str, input().split())) # print(a) # print(b) c = {} flag = True for i in range(n): if a[i] == b[i]: continue if a[i][0] in '0123456789' and b[i][0] in '0123456789' and not(a[i] == b[i]): flag = False break if a[i][0] in '0123456789': a[i] = int(a[i]) if b[i] in c: if a[i] == c[b[i]]: continue else: flag = False break else: c[b[i]] = a[i] elif b[i][0] in '0123456789': b[i] = int(b[i]) if a[i] in c: if b[i] == c[a[i]]: continue else: flag = False break else: c[a[i]] = b[i] else: if (a[i] in c) and (not(b[i] in c)): c[b[i]] = c[a[i]] elif (not(a[i] in c)) and (b[i] in c): c[a[i]] = c[b[i]] elif (a[i] in c) and (b[i] in c): if c[a[i]] == b[a[i]]: continue else: flag = False break else: continue if flag: print("DA") else: print("NE") # print(c)
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...