結果
| 問題 | No.424 立体迷路 |
| コンテスト | |
| ユーザー |
👑 tails
|
| 提出日時 | 2016-09-23 00:13:15 |
| 言語 | C90(gcc12) (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 676 bytes |
| 記録 | |
| コンパイル時間 | 179 ms |
| コンパイル使用メモリ | 30,276 KB |
| 最終ジャッジ日時 | 2026-02-23 22:23:53 |
|
ジャッジサーバーID (参考情報) |
judge1 / 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:3: warning: data definition has no type or storage class
1 | h;w;a;b;
| ^
main.c:1:5: warning: data definition has no type or storage class
1 | h;w;a;b;
| ^
main.c:1:7: warning: data definition has no type or storage class
1 | h;w;a;b;
| ^
main.c: In function ‘main’:
main.c:19:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
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 of ‘scanf’
+++ |+#include <stdio.h>
1 | h;w;a;b;
main.c:24:9: warning: incompatible implicit declaration of built-in function ‘exit’ [-Wbuiltin-declaration-mismatch]
24 | exit(0);
| ^~~~
main.c:1:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
+++ |+#include <stdlib.h>
1 | h;w;a;b;
/usr/bin/ld: /tmp/ccZHc6JT.o: in function `main':
main.c:(.text.startup+0x6d): 警告: the `gets' function is dangerous and should not be used.
ソースコード
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);
}
tails