結果

問題 No.1603 Manhattan Social Distance
ユーザー lloyzlloyz
提出日時 2021-12-31 22:54:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 627 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-17 11:26:33
合計ジャッジ時間 1,660 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 28 ms
10,624 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 29 ms
10,624 KB
testcase_05 AC 29 ms
10,624 KB
testcase_06 AC 29 ms
10,624 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 28 ms
10,752 KB
testcase_09 AC 29 ms
10,624 KB
testcase_10 AC 29 ms
10,624 KB
testcase_11 WA -
testcase_12 AC 29 ms
10,752 KB
testcase_13 AC 27 ms
10,752 KB
testcase_14 AC 27 ms
10,752 KB
testcase_15 AC 28 ms
10,752 KB
testcase_16 AC 28 ms
10,752 KB
testcase_17 AC 27 ms
10,752 KB
testcase_18 AC 27 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, h, w = map(int, input().split())
if h < w:
    h, w = w, h
if h == w == 1:
    print(0)
elif w == 1:
    n1 = n // 2
    n2 = n - n1
    h -= 1
    print(n1 * n2 * h)
else:
    q, r = divmod(n, 4)
    h -= 1
    w -= 1
    if r == 0:
        print(q * q * 2 * (h + w) + q * q * 2 * (h + w))
    elif r == 1:
        print((q * q + q * (q + 1)) * (h + w) + (q * (q * 1) + q * q) * (h + w))
    elif r == 2:
        print(((q + 1) * (q + 1) + q * q) * (h + w) + q * (q + 1) * 2 * (h + w))
    else:
        print(((q + 1) * (q + 1) + (q + 1) * q) * (h + w) + ((q + 1) * (q + 1) + (q + 1) * q) * (h + w))
0