結果
| 問題 | No.707 書道 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-04-25 10:25:19 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 125 ms / 2,000 ms |
| コード長 | 447 bytes |
| 記録 | |
| コンパイル時間 | 182 ms |
| コンパイル使用メモリ | 84,864 KB |
| 実行使用メモリ | 76,928 KB |
| 最終ジャッジ日時 | 2026-04-25 10:25:26 |
| 合計ジャッジ時間 | 2,565 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
ソースコード
H,W = map(int, input().split())
def dist(a,b,x,y):
return ((a-x)**2+(b-y)**2)**0.5
pos = {}
for i in range(1,H+1):
pos[(i,0)] = 0
pos[(i,W+1)] = 0
for j in range(1,W+1):
pos[(0,j)] = 0
pos[(H+1,j)] = 0
for i in range(H):
s = input()
for j in range(W):
if s[j]=="1":
for y,x in pos:
pos[(y,x)] += dist(i+1,j+1,y,x)
ans = 10**10
for y,x in pos:
ans = min(ans,pos[(y,x)])
print(ans)