Submission #994596

#TimeUsernameProblemLanguageResultExecution timeMemory
994596rsinventorZamjena (COCI18_zamjena)Cpython 3
14 / 70
28 ms6236 KiB
n = eval(input()); a = input().split(" ") b = input().split(" ") for i in range(n): if a[i].isnumeric(): a[i] = eval(a[i]) if b[i].isnumeric(): b[i] = eval(b[i]) variables = {} flag = True; for i in range(n): if a[i]!=b[i] and type(a[i])==str and type(b[i])==str: if a[i] in variables.keys() and b[i] in variables.keys(): if(variables[a[i]]!=variables[b[i]]): flag = False break elif a[i] in variables.keys(): variables[b[i]] = variables[a[i]] elif b[i] in variables.keys(): variables[a[i]] = variables[b[i]] elif a[i]!=b[i] and type(a[i])==str: if a[i] in variables.keys(): if(variables[a[i]]!=b[i]): flag = False break else: variables[a[i]] = b[i] elif a[i]!=b[i] and type(b[i])==str: if b[i] in variables.keys(): if(variables[b[i]]!=a[i]): flag = False break else: variables[b[i]] = a[i] if flag: for i in range(n): if a[i]!=b[i] and type(a[i])==str and type(b[i])==str: if a[i] in variables.keys() and b[i] in variables.keys(): if(variables[a[i]]!=variables[b[i]]): flag = False break elif a[i] in variables.keys(): variables[b[i]] = variables[a[i]] elif b[i] in variables.keys(): variables[a[i]] = variables[b[i]] elif a[i]!=b[i] and type(a[i])==str: if a[i] in variables.keys(): if(variables[a[i]]!=b[i]): flag = False break else: variables[a[i]] = b[i] elif a[i]!=b[i] and type(b[i])==str: if b[i] in variables.keys(): if(variables[b[i]]!=a[i]): flag = False break else: variables[b[i]] = a[i] if flag: print("DA") else: print("NE")
#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...