結果
問題 | No.323 yuki国 |
ユーザー | 37zigen |
提出日時 | 2016-03-14 03:17:54 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,479 bytes |
コンパイル時間 | 6,054 ms |
コンパイル使用メモリ | 84,892 KB |
実行使用メモリ | 362,848 KB |
最終ジャッジ日時 | 2023-10-26 04:00:04 |
合計ジャッジ時間 | 20,432 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 139 ms
57,284 KB |
testcase_01 | AC | 138 ms
57,696 KB |
testcase_02 | AC | 157 ms
59,384 KB |
testcase_03 | AC | 146 ms
66,240 KB |
testcase_04 | AC | 141 ms
57,564 KB |
testcase_05 | AC | 220 ms
62,352 KB |
testcase_06 | AC | 214 ms
60,808 KB |
testcase_07 | AC | 141 ms
59,348 KB |
testcase_08 | AC | 571 ms
358,408 KB |
testcase_09 | WA | - |
testcase_10 | AC | 166 ms
57,400 KB |
testcase_11 | AC | 141 ms
57,300 KB |
testcase_12 | AC | 142 ms
57,308 KB |
testcase_13 | WA | - |
testcase_14 | AC | 465 ms
361,300 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 234 ms
132,516 KB |
testcase_19 | AC | 389 ms
233,232 KB |
testcase_20 | AC | 424 ms
360,988 KB |
testcase_21 | AC | 527 ms
361,172 KB |
testcase_22 | WA | - |
testcase_23 | AC | 518 ms
361,156 KB |
testcase_24 | AC | 452 ms
361,236 KB |
testcase_25 | AC | 506 ms
361,436 KB |
testcase_26 | AC | 454 ms
361,064 KB |
testcase_27 | AC | 511 ms
361,284 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | AC | 158 ms
59,952 KB |
testcase_31 | AC | 197 ms
60,288 KB |
testcase_32 | AC | 203 ms
58,572 KB |
testcase_33 | AC | 215 ms
60,872 KB |
testcase_34 | AC | 231 ms
62,548 KB |
testcase_35 | AC | 159 ms
57,924 KB |
testcase_36 | AC | 209 ms
60,444 KB |
testcase_37 | AC | 141 ms
57,588 KB |
ソースコード
import java.util.ArrayDeque; import java.util.Date; import java.util.Queue; import java.util.Scanner; public class main{ static class snow{ int x,y,z; snow(int x,int y,int z){ this.x=x; this.y=y; this.z=z; } } static int[] dx={1,0,-1,0}; static int[] dy={0,1,0,-1}; public static void main(String[] args){ Scanner sc=new Scanner(System.in); long exec_time=new Date().getTime(); int h=sc.nextInt(); int w=sc.nextInt(); int a=sc.nextInt(); int si=sc.nextInt(); int sj=sc.nextInt(); int b=sc.nextInt(); int gi=sc.nextInt(); int gj=sc.nextInt(); boolean[][] map=new boolean[h][w]; for(int i=0;i<h;i++){ String tmp=sc.next(); for(int j=0;j<w;j++){ if(tmp.charAt(j)=='*')map[i][j]=true; } } boolean[][][] used=new boolean[h][w][100000]; Queue<snow> q=new ArrayDeque<>(); q.add(new snow(si,sj,a)); int count=0; while(!q.isEmpty()){ snow now=q.poll(); count++; if(count>300000)break; if(now.x==gi&&now.y==gj&&now.z==b){ System.out.println("Yes"); return; } for(int i=0;i<4;i++){ int nextx=now.x+dx[i]; int nexty=now.y+dy[i]; if(nextx>=0&&nextx<h&&nexty>=0&&nexty<w){ int nextz=now.z+(map[nextx][nexty]?1:-1); if(nextz<=0||nextz>50000||used[nextx][nexty][nextz])continue; q.add(new snow(nextx,nexty,nextz)); used[nextx][nexty][nextz]=true; } } } System.out.println("No"); System.err.println(new Date().getTime()-exec_time+"ms"); } }