結果
| 問題 | No.3679 なんかでっかい虫リターンズ |
| コンテスト | |
| ユーザー |
msksknkn
|
| 提出日時 | 2026-09-12 20:08:03 |
| 言語 | Java (openjdk 26.0.2.1 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 1,485 bytes |
| 記録 | |
| コンパイル時間 | 1,421 ms |
| コンパイル使用メモリ | 85,856 KB |
| 実行使用メモリ | 43,124 KB |
| 最終ジャッジ日時 | 2026-09-12 20:08:16 |
| 合計ジャッジ時間 | 5,023 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 13 WA * 4 |
ソースコード
package no3679_nannkadekkaimushi;
import java.util.*;
public class Main {
public static void main(String[] args) {
// TODO 自動生成されたメソッド・スタブ
Scanner sc = new Scanner(System.in);
sc.nextInt();
sc.nextInt();
int x = sc.nextInt();
int y = sc.nextInt();
int hf = sc.nextInt();
int wf = sc.nextInt();
int he = sc.nextInt();
int we = sc.nextInt();
int p = sc.nextInt();
int q = sc.nextInt();
int ans = Math.abs(p - x) + Math.abs(q - y);
int l = 0;
//初期位置が虫の上
if(x <= hf) {
//System.out.println("Up");
//左側
if(y <= wf) {
l = Math.abs(y - wf) + Math.abs(x - hf);
x = hf;
y = wf;
}//右側
else if(y > we) {
l = Math.abs(y - we) + Math.abs(x - hf);
x = hf;
y = wf;
}//真上
else {
l = Math.abs(x - hf);
x = hf;
}
}//初期位置が虫と同じくらいの高さ
else if(x > hf && x <= he) {
//左側
if(y <= wf) {
l = Math.abs(wf - y);
y = wf;
}//右側
if(y > we) {
l = Math.abs(we - y);
y = we;
}//それ以外は動かない
}//初期位置が虫の下
else if(x > he) {
//左
if(y <= wf) {
l = Math.abs(x - he) + Math.abs(y - wf);
x = he;
y = wf;
}//右
if(y > we) {
l = Math.abs(x - he) + Math.abs(y - we);
x = he;
y = we;
}//真下
else {
l = Math.abs(x - he);
x = he;
}
}ans += l + Math.abs(p - x) + Math.abs(q - y);
System.out.println(ans);
}
}
msksknkn