結果

問題 No.1603 Manhattan Social Distance
ユーザー mkawa2
提出日時 2021-07-16 21:59:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 887 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-06 09:08:00
合計ジャッジ時間 1,596 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**16
md = 998244353
# md = 10**9+7

n, h, w = LI()
q, r = divmod(n, 4)
c0 = c1 = c2 = c3 = q
if r >= 1: c0 += 1
if r >= 2: c2 += 1
if r >= 3: c1 += 1
# print(c0,c1,c2,c3)

ans = 0
ans += c0*c1*(w-1)
ans += c0*c2*(h+w-2)
ans += c0*c3*(h-1)
ans += c1*c2*(h-1)
ans += c1*c3*(h+w-2)
ans += c2*c3*(w-1)
print(ans)
0