結果
問題 | No.323 yuki国 |
ユーザー |
|
提出日時 | 2020-06-14 04:43:20 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 84 ms / 5,000 ms |
コード長 | 762 bytes |
コンパイル時間 | 3,210 ms |
コンパイル使用メモリ | 201,208 KB |
最終ジャッジ日時 | 2025-01-11 04:09:26 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:10:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | int h,w; scanf("%d%d",&h,&w); | ~~~~~^~~~~~~~~~~~~~ main.cpp:11:28: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | int sn,sy,sx; scanf("%d%d%d",&sn,&sy,&sx); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~ main.cpp:12:28: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | int gn,gy,gx; scanf("%d%d%d",&gn,&gy,&gx); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~ main.cpp:14:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 14 | rep(i,h) scanf("%s",B[i]); | ~~~~~^~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>#define rep(i,n) for(int i=0;i<(n);i++)using namespace std;const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};int main(){int h,w; scanf("%d%d",&h,&w);int sn,sy,sx; scanf("%d%d%d",&sn,&sy,&sx);int gn,gy,gx; scanf("%d%d%d",&gn,&gy,&gx);char B[50][51];rep(i,h) scanf("%s",B[i]);static bool vis[50][50][1200];vis[sy][sx][sn]=true;queue<tuple<int,int,int>> Q; Q.emplace(sy,sx,sn);while(!Q.empty()){int y,x,n; tie(y,x,n)=Q.front(); Q.pop();rep(k,4){int yy=y+dy[k],xx=x+dx[k];if(0<=yy && yy<h && 0<=xx && xx<w){int nn=n+(B[yy][xx]=='*'?1:-1);if(0<nn && nn<1200 && !vis[yy][xx][nn]){vis[yy][xx][nn]=true;Q.emplace(yy,xx,nn);}}}}puts(vis[gy][gx][gn]?"Yes":"No");return 0;}