結果
| 問題 | No.3679 なんかでっかい虫リターンズ |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2026-07-14 23:07:35 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 63 ms / 2,000 ms |
| + 490µs | |
| コード長 | 470 bytes |
| 記録 | |
| コンパイル時間 | 227 ms |
| コンパイル使用メモリ | 95,820 KB |
| 実行使用メモリ | 85,076 KB |
| 最終ジャッジ日時 | 2026-09-05 12:39:36 |
| 合計ジャッジ時間 | 3,282 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
def dist(pos1, pos2):
r1, c1 = pos1
r2, c2 = pos2
return abs(r1 - r2) + abs(c1 - c2)
H, W = [int(s) for s in input().split()]
A, B = [int(s) for s in input().split()]
R1, C1, R2, C2 = [int(s) for s in input().split()]
P, Q = [int(s) for s in input().split()]
start = (A, B)
bugs = [(r, c) for r in range(R1, R2 + 1) for c in range(C1, C2 + 1)]
trash = (P, Q)
ans = min(dist(start, bug) + dist(bug, trash) + dist(trash, start) for bug in bugs)
print(ans)