結果
問題 | No.323 yuki国 |
ユーザー | piyoko_212 |
提出日時 | 2015-12-21 00:02:00 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1,160 ms / 5,000 ms |
コード長 | 870 bytes |
コンパイル時間 | 411 ms |
コンパイル使用メモリ | 48,332 KB |
実行使用メモリ | 121,216 KB |
最終ジャッジ日時 | 2024-06-28 12:29:05 |
合計ジャッジ時間 | 17,759 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | int a,b;scanf("%d%d",&a,&b); | ~~~~~^~~~~~~~~~~~~~ main.cpp:12:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d%d%d%d%d%d",&c,&d,&e,&f,&g,&h); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ main.cpp:13:34: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | for(int i=0;i<a;i++)scanf("%s",str[i]); | ~~~~~^~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<algorithm> #include<queue> using namespace std; int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; char str[100][100]; int bfs[52][52][12100]; int main(){ int a,b;scanf("%d%d",&a,&b); int c,d,e,f,g,h; scanf("%d%d%d%d%d%d",&c,&d,&e,&f,&g,&h); for(int i=0;i<a;i++)scanf("%s",str[i]); bfs[d][e][c]=1; queue<pair<pair<int,int>,int> > Q; Q.push(make_pair(make_pair(d,e),c)); while(Q.size()){ int row=Q.front().first.first; int col=Q.front().first.second; int yu=Q.front().second; Q.pop(); for(int i=0;i<4;i++){ int tr=row+dx[i];int tc=col+dy[i]; int ty=yu; if(tr<0||tc<0||tr>=a||tc>=b)continue; if(str[tr][tc]=='*')ty++; else ty--; if(ty<=0||ty>=12100)continue; if(bfs[tr][tc][ty])continue; bfs[tr][tc][ty]=1; Q.push(make_pair(make_pair(tr,tc),ty)); } } if(bfs[g][h][f])printf("Yes\n");else printf("No\n"); }