結果
問題 | No.323 yuki国 |
ユーザー | ciel |
提出日時 | 2019-01-21 23:54:29 |
言語 | C++17(clang) (17.0.6 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 3,067 ms / 5,000 ms |
コード長 | 935 bytes |
コンパイル時間 | 2,331 ms |
コンパイル使用メモリ | 94,968 KB |
実行使用メモリ | 89,348 KB |
最終ジャッジ日時 | 2023-08-20 11:46:31 |
合計ジャッジ時間 | 36,305 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,384 KB |
testcase_01 | AC | 1 ms
4,384 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,384 KB |
testcase_04 | AC | 2 ms
4,384 KB |
testcase_05 | AC | 2 ms
4,380 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 2 ms
4,380 KB |
testcase_08 | AC | 2,182 ms
85,672 KB |
testcase_09 | AC | 2,245 ms
85,524 KB |
testcase_10 | AC | 1 ms
4,380 KB |
testcase_11 | AC | 2 ms
4,380 KB |
testcase_12 | AC | 2 ms
4,380 KB |
testcase_13 | AC | 2,154 ms
85,356 KB |
testcase_14 | AC | 2,178 ms
89,348 KB |
testcase_15 | AC | 2,405 ms
72,344 KB |
testcase_16 | AC | 2,311 ms
85,668 KB |
testcase_17 | AC | 2,834 ms
81,456 KB |
testcase_18 | AC | 13 ms
4,380 KB |
testcase_19 | AC | 1,765 ms
54,468 KB |
testcase_20 | AC | 34 ms
5,404 KB |
testcase_21 | AC | 3,067 ms
82,548 KB |
testcase_22 | AC | 634 ms
25,100 KB |
testcase_23 | AC | 2,885 ms
78,556 KB |
testcase_24 | AC | 142 ms
10,388 KB |
testcase_25 | AC | 2,743 ms
80,692 KB |
testcase_26 | AC | 141 ms
10,184 KB |
testcase_27 | AC | 187 ms
11,932 KB |
testcase_28 | AC | 2,717 ms
85,856 KB |
testcase_29 | AC | 2,713 ms
86,084 KB |
testcase_30 | AC | 2 ms
4,384 KB |
testcase_31 | AC | 2 ms
4,380 KB |
testcase_32 | AC | 2 ms
4,384 KB |
testcase_33 | AC | 2 ms
4,380 KB |
testcase_34 | AC | 1 ms
4,384 KB |
testcase_35 | AC | 1 ms
4,384 KB |
testcase_36 | AC | 2 ms
4,380 KB |
testcase_37 | AC | 2 ms
4,384 KB |
ソースコード
#include <iostream> #include <string> #include <queue> #include <map> using namespace std; typedef struct{ int x; int y; }dir; const dir D[]={ {0,-1},{0,1},{-1,0},{1,0} }; int main(){ int H,W,A,Sx,Sy,B,Gx,Gy; cin>>H>>W>>A>>Sy>>Sx>>B>>Gy>>Gx; vector<string>v(H); for(int i=0;i<H;i++)cin>>v[i]; queue<tuple<int,int,int>>q; q.emplace(Sx,Sy,A); map<tuple<int,int,int>,int>depth={ {make_tuple(Sx,Sy,A),0} }; for(;!q.empty();){ auto cur=q.front();q.pop(); int cx=get<0>(cur),cy=get<1>(cur),cw=get<2>(cur); for(auto &d:D){ if(0<=cx+d.x&&cx+d.x<W && 0<=cy+d.y&&cy+d.y<H){ int w=cw+(v[cy+d.y][cx+d.x]=='*' ? 1 : -1); if(1<=w && w<=max(A,B)+H+W){ if(cx+d.x==Gx && cy+d.y==Gy && w==B){ cout<<"Yes"<<endl; return 0; } auto nxt=make_tuple(cx+d.x,cy+d.y,w); if(depth.find(nxt)==depth.end()){ q.push(nxt); depth[nxt]=depth[cur]+1; } } } } } cout<<"No"<<endl; }