結果
| 問題 |
No.424 立体迷路
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-22 22:58:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 2,799 bytes |
| コンパイル時間 | 1,421 ms |
| コンパイル使用メモリ | 163,084 KB |
| 最終ジャッジ日時 | 2024-11-14 19:52:01 |
| 合計ジャッジ時間 | 1,949 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:35:5: error: 'gets' was not declared in this scope; did you mean 'getw'?
35 | gets(maze[0]);//dammy;
| ^~~~
| getw
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef unsigned int uint;
typedef long long int ll;
typedef unsigned long long int ull;
#define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout<<e<<" ";}cout<<endl;
#define debugm(m) printf("L%d %s is..\n",__LINE__,#m);for(auto v:m){for(auto e:v){cout<<e<<" ";}cout<<endl;}
#define debuga(m,w) printf("L%d %s is => ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl;
#define debugaa(m,w,h) printf("L%d %s is..\n",__LINE__,#m);for(int y=0;y<(h);y++){for(int x=0;x<(w);x++){cout<<(m)[x][y]<<" ";}cout<<endl;}
#define ALL(v) (v).begin(),(v).end()
#define BIGINT 0x7FFFFFFF
#define E107 1000000007
#define TIME chrono::system_clock::now
#define MILLISEC(t) (chrono::duration_cast<chrono::milliseconds>(t).count())
template<typename T1,typename T2>
ostream& operator <<(ostream &o,const pair<T1,T2> p){o<<"("<<p.first<<":"<<p.second<<")";return o;}
char maze[100][100];
int height,width;
int sx,sy,gx,gy;
int main(){
int i,j,k,l;
cin>>height>>width;
cin >>sy>>sx>>gy>>gx; // (゚д゚)
sx--;sy--;gx--;gy--;
gets(maze[0]);//dammy;
for (i=0;i<height;i++){
gets(maze[i]);
}
queue<vector<int>> q;
q.push(vector<int>{sy,sx});
int x,y,hi;
while(!q.empty()){
vector<int> &v = q.front();
x=v[1];y=v[0];hi=maze[y][x];
q.pop();
//printf("%d %d %c\n",x,y,maze[y][x]);
maze[y][x]='g';
if (y==gy && x==gx){
cout<<"YES"<<endl;
return 0;
}
if (0<x && maze[y][x-1]!='g' && abs(maze[y][x-1]-hi)<=1){
q.push(vector<int>{y,x-1});
}
if (0<y && maze[y-1][x]!='g' && abs(maze[y-1][x]-hi)<=1){
q.push(vector<int>{y-1,x});
}
if (x<width-1 && maze[y][x+1]!='g' && abs(maze[y][x+1]-hi)<=1){
q.push(vector<int>{y,x+1});
}
if (y<height-1 && maze[y+1][x]!='g' && abs(maze[y+1][x]-hi)<=1){
q.push(vector<int>{y+1,x});
}
if (1<x && maze[y][x-2]!='g' && maze[y][x-2]==hi && maze[y][x-1]<hi){
q.push(vector<int>{y,x-2});
}
if (1<y && maze[y-2][x]!='g' && maze[y-2][x]==hi && maze[y-1][x]<hi){
q.push(vector<int>{y-2,x});
}
if (x<width-2 && maze[y][x+2]!='g' && maze[y][x+2]==hi && maze[y][x+1]<hi){
q.push(vector<int>{y,x+2});
}
if (y<height-2 && maze[y+2][x]!='g' && maze[y+2][x]==hi && maze[y+1][x]<hi){
q.push(vector<int>{y+2,x});
}
}
// for (y=0;y<height;y++){
// for (x=0;x<width;x++){
// putchar(maze[y][x]);
// }
// cout<<endl;
// }
cout<<"NO"<<endl;
return 0;
}