Submission #3623585


Source Code Expand

#!/usr/bin/env python3
import sys
try: from typing import Any, Union, List, Tuple, Dict
except ImportError: pass
sys.setrecursionlimit(10**6)
def debug(*args): print(*args, file=sys.stderr)
def exit(): sys.exit(0)


x, y = map(int, input().split())


ans = -1

if y > 0:
    if y < x:
        ans = 1 + y + x
    elif 0 <= x < y:
        ans = y - x
    elif -y <= x < 0:
        ans = 1 + y - (-x)
    elif x < -y:
        ans = (-y) - x + 1
    else:
        raise Exception("hoge")
elif y == 0:
    if x > 0:
        ans = 1 + (-x)
    else:
        ans = -x
elif y < 0:
    if x < y:
        ans = y - x
    elif y < x < 0:
        ans = 1 + (-y) - (-x) + 1
    elif 0 <= x <= -y:
        ans = (-y) - x + 1
    elif -y < x:
        ans = 1 + y - (-x)
    else:
        raise Exception("fuga")

print(ans)

Submission Info

Submission Time
Task A - Simple Calculator
User wktkshn
Language PyPy3 (2.4.0)
Score 0
Code Size 853 Byte
Status WA
Exec Time 178 ms
Memory 38256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 12
WA × 2
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt
Case Name Status Exec Time Memory
0_00.txt AC 178 ms 38256 KB
0_01.txt AC 173 ms 38256 KB
0_02.txt AC 173 ms 38256 KB
1_00.txt AC 177 ms 38256 KB
1_01.txt AC 177 ms 38256 KB
1_02.txt AC 173 ms 38256 KB
1_03.txt WA 173 ms 38256 KB
1_04.txt AC 170 ms 38256 KB
1_05.txt WA 171 ms 38256 KB
1_06.txt AC 173 ms 38256 KB
1_07.txt AC 172 ms 38256 KB
1_08.txt AC 171 ms 38256 KB
1_09.txt AC 169 ms 38256 KB
1_10.txt AC 171 ms 38256 KB