結果
問題 | No.323 yuki国 |
ユーザー | yuppe19 😺 |
提出日時 | 2015-12-16 07:40:35 |
言語 | C++11 (gcc 13.3.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,486 bytes |
コンパイル時間 | 671 ms |
コンパイル使用メモリ | 68,196 KB |
最終ジャッジ日時 | 2024-11-14 19:31:11 |
合計ジャッジ時間 | 1,290 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘bool nya(std::queue<std::tuple<int, int, int> >)’: main.cpp:21:9: error: variable ‘Tup cur’ has initializer but incomplete type 21 | Tup cur = que.front(); que.pop(); | ^~~ main.cpp:25:18: error: ‘r’ was not declared in this scope 25 | if(w == b && r == gr && c == gc) { return true; } | ^ main.cpp:25:29: error: ‘c’ was not declared in this scope 25 | if(w == b && r == gr && c == gc) { return true; } | ^ main.cpp:26:13: error: ‘r’ was not declared in this scope 26 | if(seen[r][c][w]) { continue; } | ^ main.cpp:26:16: error: ‘c’ was not declared in this scope 26 | if(seen[r][c][w]) { continue; } | ^ main.cpp:27:10: error: ‘r’ was not declared in this scope 27 | seen[r][c][w] = true; | ^ main.cpp:27:13: error: ‘c’ was not declared in this scope 27 | seen[r][c][w] = true; | ^ main.cpp:31:31: error: ‘nc’ was not declared in this scope; did you mean ‘nr’? 31 | if(nr < 0 || R <= nr || nc < 0 || C <= nc) { continue; } | ^~ | nr main.cpp:33:16: error: ‘nc’ was not declared in this scope; did you mean ‘nw’? 33 | if(G[nr][nc] == '.') { | ^~ | nw main.cpp:39:35: error: ‘nc’ was not declared in this scope; did you mean ‘nw’? 39 | que.push(make_tuple(nw, nr, nc)); | ^~ | nw main.cpp:39:16: error: ‘make_tuple’ was not declared in this scope 39 | que.push(make_tuple(nw, nr, nc)); | ^~~~~~~~~~ main.cpp:4:1: note: ‘std::make_tuple’ is defined in header ‘<tuple>’; did you forget to ‘#include <tuple>’? 3 | #include <queue> +++ |+#include <tuple> 4
ソースコード
#include <iostream> #include <algorithm> #include <queue> using namespace std; using i64 = long long; using Tup = tuple<int, int, int>; class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x<lhs.x;}void operator++(){++x;}};I i,n; public:range(int n):i({0}),n({n}){}range(int i,int n):i({i}),n({n}){}I& begin(){return i;}I& end(){return n;}}; int R, C; int a, b; int sr, sc, gr, gc; vector<string> G; vector<int> dr = {0, 0, 1, -1}, dc = {1, -1, 0, 0}; vector<vector<vector<bool>>> seen; bool nya(queue<Tup> que) { while(!que.empty()) { Tup cur = que.front(); que.pop(); int w = get<0>(cur), r = get<1>(cur), c = get<2>(cur); if(w == b && r == gr && c == gc) { return true; } if(seen[r][c][w]) { continue; } seen[r][c][w] = true; for(int i : range(dr.size())) { int nr = r + dr[i], nc = c + dc[i]; if(nr < 0 || R <= nr || nc < 0 || C <= nc) { continue; } int nw = w; if(G[nr][nc] == '.') { nw = w - 1; } else { nw = w + 1; } if(nw <= 0) { continue; } que.push(make_tuple(nw, nr, nc)); } } return false; } int main(void) { scanf("%d%d%d%d%d%d%d%d", &R, &C, &a, &sr, &sc, &b, &gr, &gc); G.resize(R); seen.assign(R, vector<vector<bool>>(C, vector<bool>(4000))); for(int r : range(R)) { cin >> G[r]; } queue<Tup> que; que.push(make_tuple(a, sr, sc)); puts(nya(que) ? "Yes" : "No"); return 0; }