結果
| 問題 | No.3679 なんかでっかい虫リターンズ |
| コンテスト | |
| ユーザー |
テナガザル
|
| 提出日時 | 2026-09-05 13:14:35 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 302µs | |
| コード長 | 495 bytes |
| 記録 | |
| コンパイル時間 | 872 ms |
| コンパイル使用メモリ | 165,744 KB |
| 実行使用メモリ | 9,788 KB |
| 最終ジャッジ日時 | 2026-09-05 13:14:38 |
| 合計ジャッジ時間 | 2,041 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int h, w, a, b;
cin >> h >> w >> a >> b;
int r[2], c[2];
for (int i = 0; i < 2; ++i) cin >> r[i] >> c[i];
int ans = 1e9;
int p, q;
cin >> p >> q;
for (int i = r[0]; i <= r[1]; ++i)
{
for (int j = c[0]; j <= c[1]; ++j)
{
int tmp = abs(a - i) + abs(b - j) + abs(i - p) + abs(j - q) + abs(p - a) + abs(q - b);
ans = min(ans, tmp);
}
}
cout << ans << endl;
}
テナガザル