This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
n=int(input())
c=[]
t=0
for i in range(n):
a=input()
b=input()
c.append([a,b])
for i in range(n):
for j in range(i+1,n):
if c[i][0]==c[j][1] or c[i][1]==c[j][0] or c[i][0][0]==c[j][0][1] and c[i][1][0]==c[j][1][1] or c[j][0][0]==c[i][0][1] and c[j][1][0]==c[i][1][1]:
t+=1
print(t)
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |