Submission #6416925


Source Code Expand

def f(x, y):
    if x < y:
        x = revXs[x]
    else:
        y = revXs[y]
    if x < y:
        y -= x
    else:
        x -= y
    return (x, y)

N, M = map(int, input().split())

revXs = [int(str(x)[::-1]) for x in range(1000)]

usedss = [[False]*(1000) for _ in range(1000)]
is0ss = [[False]*(1000) for _ in range(1000)]

def rec(x, y):
    if not usedss[x][y]:
        usedss[x][y] = True
        if x == 0 or y == 0:
            is0ss[x][y] = True
        else:
            x2, y2 = f(x, y)
            is0ss[x][y] = rec(x2, y2)
    return is0ss[x][y]

ans = 0
for x in range(1, N+1):
    for y in range(1, M+1):
        if not rec(x, y):
            ans += 1

print(ans)

Submission Info

Submission Time
Task D - うほょじご
User ZollingerPython3
Language Python (3.4.3)
Score 400
Code Size 717 Byte
Status AC
Exec Time 1066 ms
Memory 19188 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 19
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt
All 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt AC 1066 ms 19188 KB
02.txt AC 67 ms 18804 KB
03.txt AC 669 ms 19060 KB
04.txt AC 75 ms 18804 KB
05.txt AC 75 ms 18804 KB
06.txt AC 66 ms 18804 KB
07.txt AC 67 ms 18804 KB
08.txt AC 1050 ms 19060 KB
09.txt AC 92 ms 18804 KB
10.txt AC 896 ms 19060 KB
11.txt AC 1058 ms 19060 KB
12.txt AC 66 ms 18804 KB
13.txt AC 67 ms 18804 KB
14.txt AC 338 ms 19060 KB
15.txt AC 66 ms 18804 KB
16.txt AC 438 ms 19060 KB
s1.txt AC 66 ms 18804 KB
s2.txt AC 66 ms 18804 KB
s3.txt AC 153 ms 19188 KB