結果
問題 | No.323 yuki国 |
ユーザー |
|
提出日時 | 2015-12-16 00:12:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 208 ms / 5,000 ms |
コード長 | 1,353 bytes |
コンパイル時間 | 1,318 ms |
コンパイル使用メモリ | 168,016 KB |
実行使用メモリ | 14,020 KB |
最終ジャッジ日時 | 2024-06-28 12:17:59 |
合計ジャッジ時間 | 5,096 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 32 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:41:33: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 41 | REP(i,1,n) scanf("%s", mp[i]+1); | ~~~~~^~~~~~~~~~~~~~~ main.cpp: In function ‘void RI(int&, T& ...) [with T = {int, int}]’: main.cpp:16:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d",&head); | ~~~~~^~~~~~~~~~~~ main.cpp: In function ‘void RI(int&, T& ...) [with T = {int}]’: main.cpp:16:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] main.cpp: In function ‘void RI(int&, T& ...) [with T = {}]’: main.cpp:16:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
ソースコード
#include<bits/stdc++.h> #define REP(x,y,z) for(int x=y;x<=z;x++) #define FORD(x,y,z) for(int x=y;x>=z;x--) #define MSET(x,y) memset(x,y,sizeof(x)) #define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++) #define F first #define S second #define MP make_pair #define PB push_back #define SZ size() #define M 55 #define MT make_tuple void RI(){} template<typename... T> void RI( int& head, T&... tail ) { scanf("%d",&head); RI(tail...); } using namespace std; typedef long long LL; typedef tuple<int,int,int> T; int n,m; int dx[4]={1,-1,0,0},dy[4]={0,0,1,-1}; int sx,sy,sz; int ex,ey,ez; bool vis[M][M][3505]; char mp[M][M]; bool out(int x,int y) { return x<=0 || y<=0 || x>n || y>m; } int main() { int x,y,z; int nx,ny,nz; while(~scanf("%d %d",&n,&m)) { RI(sz,sx,sy); sx++; sy++; RI(ez,ex,ey); ex++; ey++; REP(i,1,n) scanf("%s", mp[i]+1); MSET(vis,false); queue<T> q; vis[sx][sy][sz] = true; q.push(MT(sx,sy,sz)); while(!q.empty()) { tie(x,y,z) = q.front(); q.pop(); REP(i,0,3) { nx = x+dx[i]; ny = y+dy[i]; if(out(nx,ny)) continue; nz = z; if(mp[nx][ny]=='*') nz++; else nz--; if(nz<=0 || nz>3500) continue; if(vis[nx][ny][nz]) continue; vis[nx][ny][nz] = true; q.push(MT(nx,ny,nz)); } } puts(vis[ex][ey][ez] ? "Yes":"No"); } return 0; }