Submission #3603254


Source Code Expand

h,w=map(int,input().split())
if h%3==0 or w%3==0:
    print(0)
elif h%2==1 and w%2==1:
    a=max(h,w)//3
    b=min(h,w)
    print(min(abs((a+1)*b-(b//2)*(max(h,w)-a-1)),abs((max(a*b,(b//2+1)*(max(h,w)-a)))-(b//2)*(max(h,w)-a))))
elif h%2==0 and w%2==0:
    a=max(h,w)//3
    b=min(h,w)
    print(min(abs((a+1)*b-(b//2)*(max(h,w)-a-1)),abs((a*b)-(b//2)*(max(h,w)-a))))
elif h%2==0 and h<w:
    a=w//3
    b=h
    print(min(abs((a+1)*b-(b//2)*(max(h,w)-a-1)),abs((a*b)-(b//2)*(max(h,w)-a))))
elif w%2==0 and h<w:
    print(w//2)

Submission Info

Submission Time
Task C - Chocolate Bar
User shel
Language Python (3.4.3)
Score 0
Code Size 542 Byte
Status WA
Exec Time 17 ms
Memory 3064 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 5
AC × 17
WA × 3
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt
All 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.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, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt
Case Name Status Exec Time Memory
0_00.txt AC 17 ms 3064 KB
0_01.txt AC 17 ms 3064 KB
0_02.txt AC 17 ms 3064 KB
0_03.txt AC 17 ms 3064 KB
0_04.txt AC 17 ms 3064 KB
1_00.txt AC 17 ms 3064 KB
1_01.txt AC 17 ms 3064 KB
1_02.txt AC 17 ms 3064 KB
1_03.txt AC 17 ms 3064 KB
1_04.txt WA 17 ms 3064 KB
1_05.txt AC 17 ms 3064 KB
1_06.txt AC 17 ms 3064 KB
1_07.txt AC 17 ms 3064 KB
1_08.txt AC 17 ms 3064 KB
1_09.txt WA 17 ms 3064 KB
1_10.txt AC 17 ms 3064 KB
1_11.txt AC 17 ms 3064 KB
1_12.txt AC 17 ms 3064 KB
1_13.txt WA 17 ms 3064 KB
1_14.txt AC 17 ms 3064 KB