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]
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 time |
Memory |
Grader output |
1 |
Correct |
10 ms |
3164 KB |
Output is correct |
2 |
Incorrect |
11 ms |
3164 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
3016 KB |
Output is correct |
2 |
Correct |
11 ms |
3164 KB |
Output is correct |
3 |
Correct |
10 ms |
3008 KB |
Output is correct |
4 |
Correct |
10 ms |
3212 KB |
Output is correct |
5 |
Correct |
10 ms |
3136 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
11 ms |
3164 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
3164 KB |
Output is correct |
2 |
Runtime error |
11 ms |
3204 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
26 ms |
4696 KB |
Output is correct |
2 |
Runtime error |
13 ms |
6236 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |