結果
| 問題 | No.3679 なんかでっかい虫リターンズ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-05 13:37:23 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 408µs | |
| コード長 | 649 bytes |
| 記録 | |
| コンパイル時間 | 1,219 ms |
| コンパイル使用メモリ | 216,340 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-09-05 13:37:49 |
| 合計ジャッジ時間 | 2,650 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int H,W,A,B; cin >> H >> W >> A >> B,A--,B--;
vector<vector<bool>> X(H,vector<bool>(W));
{
int x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2,x1--,y1--;
for(int i=x1; i<x2; i++) for(int k=y1; k<y2; k++) X.at(i).at(k) = true;
}
int P,Q; cin >> P >> Q,P--,Q--;
int answer = 1001001001;
for(int i=0; i<H; i++) for(int k=0; k<W; k++) if(X.at(i).at(k)){
int now = abs(P-A)+abs(Q-B)+abs(i-A)+abs(k-B)+abs(i-P)+abs(k-Q);
answer = min(answer,now);
}
cout << answer << endl;
}