n=int(input())
k=[[[[False for i in range(26)]for j in range(26)]for m in range(26)]for _ in range(26)]
c=[]
t=0
v=[[[0,0]for _ in range(26)]for _ in range(26)]
h=[[[0,0]for _ in range(26)]for _ in range(26)]
for i in range(n):
a=input()
b=input()
if k[ord(b[0])-65][ord(b[1])-65][ord(a[0])-65][ord(a[1])-65]:
t-=1
if k[ord(a[1])-65][ord(a[0])-65][ord(b[1])-65][ord(b[0])-65]:
t-=1
k[ord(a[0])-65][ord(a[1])-65][ord(b[0])-65][ord(b[1])-65]=True
v[ord(a[0])-65][ord(b[0])-65][0]+=1
v[ord(a[1])-65][ord(b[1])-65][1]+=1
h[ord(a[0])-65][ord(a[1])-65][0]+=1
h[ord(b[0])-65][ord(b[1])-65][1]+=1
for i in range(26):
for j in range(26):
t+=h[i][j][0]*h[i][j][1]
t+=v[i][j][0]*v[i][j][1]
print(t)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
52 ms |
9056 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
52 ms |
9056 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
1089 ms |
9120 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
9008 KB |
Output is correct |
2 |
Correct |
356 ms |
9004 KB |
Output is correct |
3 |
Execution timed out |
1065 ms |
10256 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
58 ms |
9008 KB |
Output is correct |
2 |
Incorrect |
52 ms |
9056 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |