167612025-05-12 11:28:05horkaWashington Distancepython3Wrong answer 20/10074ms3312 KiB
t=int(input())
for _ in range(t):
    s=input().split(" ")
    x1=int(s[2])
    x2=int(s[5])
    y1=ord(s[1])-65
    y2=ord(s[4])-65
    if(s[0][0]=='S'):
        x1=-1*(25-x1)
    if(s[3][0]=='S'):
        x2=-1*(25-x2)
    if(s[0][1]=='W'):
        y1*=-1
    if(s[3][1]=='W'):
        y2*=-1
    #print(x1, y1, x2, y2)
    print(abs(x1-x2)+abs(y1-y2))
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer14ms3124 KiB
subtask220/20
2Accepted17ms3120 KiB
3Accepted43ms3312 KiB
4Accepted70ms3120 KiB
subtask30/80
5Wrong answer16ms3304 KiB
6Accepted17ms3120 KiB
7Accepted43ms3312 KiB
8Accepted70ms3120 KiB
9Wrong answer17ms3124 KiB
10Wrong answer45ms3200 KiB
11Wrong answer68ms3208 KiB
12Wrong answer74ms3124 KiB
13Wrong answer74ms3304 KiB
14Wrong answer72ms3124 KiB