結果

問題 No.707 書道
ユーザー prd_xxxprd_xxx
提出日時 2018-06-29 22:48:59
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 671 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 77,820 KB
最終ジャッジ日時 2023-09-13 15:30:18
合計ジャッジ時間 1,806 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
H,W = map(int,input().split())
src = [[]]
src += ['0' + input() + '0' for i in range(H)]

ans = float('inf')
for px in (0,W+1):
    for py in range(1,H+1):
        print(px,py)
        tmp = 0
        for y in range(1,H+1):
            for x in range(1,W+1):
                if src[y][x] == '0': continue
                tmp += math.hypot(px-x, py-y)
        ans = min(ans, tmp)
for py in (0,H+1):
    for px in range(1,W+1):
        print(px,py)
        tmp = 0
        for y in range(1,H+1):
            for x in range(1,W+1):
                if src[y][x] == '0': continue
                tmp += math.hypot(px-x, py-y)
        ans = min(ans, tmp)
print(ans)
0