Submission #3027384


Source Code Expand

#! /usr/bin/env python3

import math

h, w = map(int, input().split())

if h > w:
    h, w = w, h

y = math.floor(h / 2)

x = 1
res = 10**12

while x <= w / 2:
    x2 = math.floor((w - x) / 2) + x
    areas = [x * h, (x2 - x) * h, (w - x2) * h]
    areas.sort()
    diff = areas[2] - areas[0]
    if diff < res:
        res = diff

    areas = [x * h, (w - x) * y, (w - x) * (h - y)]
    areas.sort()
    diff = areas[2] - areas[0]
    if diff < res:
        res = diff
    
    x += 1

print(res)

Submission Info

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

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 4
WA × 1
AC × 15
WA × 5
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 WA 17 ms 3064 KB
0_01.txt AC 17 ms 3064 KB
0_02.txt AC 17 ms 3064 KB
0_03.txt AC 121 ms 3064 KB
0_04.txt AC 122 ms 3064 KB
1_00.txt AC 17 ms 3064 KB
1_01.txt AC 126 ms 3064 KB
1_02.txt WA 60 ms 3064 KB
1_03.txt WA 77 ms 3064 KB
1_04.txt AC 56 ms 3064 KB
1_05.txt AC 78 ms 3064 KB
1_06.txt AC 115 ms 3064 KB
1_07.txt WA 88 ms 3064 KB
1_08.txt AC 91 ms 3064 KB
1_09.txt AC 105 ms 3064 KB
1_10.txt WA 116 ms 3064 KB
1_11.txt AC 70 ms 3064 KB
1_12.txt AC 114 ms 3064 KB
1_13.txt AC 81 ms 3064 KB
1_14.txt AC 52 ms 3064 KB