Submission #995222

#TimeUsernameProblemLanguageResultExecution timeMemory
995222rsinventorZamjena (COCI18_zamjena)Cpython 3
14 / 70
18 ms5252 KiB
n = eval(input()); a = input().split(" ") b = input().split(" ") cnt = set() def dfs(root): if root.isnumeric(): cnt.add(root) return visited[root] = True for a in adj[root]: if not visited[a]: dfs(a) visited = {} adj = {} for i in range(n): visited[a[i]] = False visited[b[i]] = False adj[a[i]] = b[i] adj[b[i]] = a[i] flag = True; for i in range(n): if a[i].isnumeric() and b[i].isnumeric() and a[i]!=b[i]: flag = False break if(visited[a[i]]==False): cnt = set() dfs(a[i]) if len(cnt)>1: flag = False break 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...