結果
問題 | No.424 立体迷路 |
ユーザー |
![]() |
提出日時 | 2016-09-23 00:13:15 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 676 bytes |
コンパイル時間 | 337 ms |
コンパイル使用メモリ | 20,992 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 07:07:16 |
合計ジャッジ時間 | 876 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 5 |
other | AC * 21 |
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class 1 | h;w;a;b; | ^ main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘h’ [-Wimplicit-int] main.c:1:3: warning: data definition has no type or storage class 1 | h;w;a;b; | ^ main.c:1:3: warning: type defaults to ‘int’ in declaration of ‘w’ [-Wimplicit-int] main.c:1:5: warning: data definition has no type or storage class 1 | h;w;a;b; | ^ main.c:1:5: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int] main.c:1:7: warning: data definition has no type or storage class 1 | h;w;a;b; | ^ main.c:1:7: warning: type defaults to ‘int’ in declaration of ‘b’ [-Wimplicit-int] main.c:4:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 4 | f(x,y){ | ^ main.c: In function ‘f’: main.c:4:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int] main.c:4:1: warning: type of ‘y’ defaults to ‘int’ [-Wimplicit-int] main.c:8:27: warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration] 8 | if(x>0 &&abs(m[x][y]-m[x-1][y])<2)f(x-1,y); | ^~~ main.c:1:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘abs’ +++ |+#include <stdlib.h> 1 | h;w;a;b; main.c: At top level: main.c:18:1: warning: return type defaults to ‘int’ [-Wimplicit-int] 18 | main(x,y,i){ | ^~~~ main.c: In function ‘main’: main.c:18:1: warning: type of ‘x’ defaults to ‘int’ [-Wimplicit-int] main.c:18:1: warning: type of ‘y’ defaults to ‘int’ [-Wimplicit-int] main.c:18:1: warning: type of ‘i’ defaults to ‘int’ [-Wimplicit-int] main.c:19:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration] 19 | scanf("%d%d%d%d%d%d ",&h,&w,&x,&y,&a,&b); | ^~~~~ main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration o
ソースコード
h;w;a;b;char m[60][60],u[60][60];char*r="NO";f(x,y){if(!u[y][x]){u[y][x]=1;if(x==a&&y==b)r="YES";if(x>0 &&abs(m[x][y]-m[x-1][y])<2)f(x-1,y);if(x<h-1&&abs(m[x][y]-m[x+1][y])<2)f(x+1,y);if(y>0 &&abs(m[x][y]-m[x][y-1])<2)f(x,y-1);if(y<w-1&&abs(m[x][y]-m[x][y+1])<2)f(x,y+1);if(x>1 &&m[x][y]==m[x-2][y]&&m[x][y]>m[x-1][y])f(x-2,y);if(x<h-2&&m[x][y]==m[x+2][y]&&m[x][y]>m[x+1][y])f(x+2,y);if(y>1 &&m[x][y]==m[x][y-2]&&m[x][y]>m[x][y-1])f(x,y-2);if(y<w-2&&m[x][y]==m[x][y+2]&&m[x][y]>m[x][y+1])f(x,y+2);}}main(x,y,i){scanf("%d%d%d%d%d%d ",&h,&w,&x,&y,&a,&b);for(i=0;i<h;++i)gets(m[i]);--x;--y;--a;--b;f(x,y);puts(r);exit(0);}