結果
問題 | No.323 yuki国 |
ユーザー | ctyl_0 |
提出日時 | 2015-12-17 02:44:07 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,995 bytes |
コンパイル時間 | 767 ms |
コンパイル使用メモリ | 99,588 KB |
実行使用メモリ | 43,180 KB |
最終ジャッジ日時 | 2023-10-14 12:11:43 |
合計ジャッジ時間 | 2,651 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,348 KB |
testcase_01 | AC | 1 ms
4,348 KB |
testcase_02 | AC | 2 ms
4,352 KB |
testcase_03 | AC | 3 ms
4,636 KB |
testcase_04 | AC | 1 ms
4,348 KB |
testcase_05 | AC | 1 ms
4,352 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 2 ms
4,352 KB |
testcase_08 | AC | 30 ms
42,876 KB |
testcase_09 | WA | - |
testcase_10 | AC | 1 ms
4,352 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 31 ms
42,948 KB |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | AC | 17 ms
27,608 KB |
testcase_20 | WA | - |
testcase_21 | AC | 29 ms
42,952 KB |
testcase_22 | WA | - |
testcase_23 | AC | 28 ms
42,936 KB |
testcase_24 | WA | - |
testcase_25 | AC | 29 ms
42,952 KB |
testcase_26 | WA | - |
testcase_27 | AC | 29 ms
42,920 KB |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | AC | 2 ms
4,352 KB |
testcase_31 | AC | 2 ms
4,348 KB |
testcase_32 | AC | 2 ms
4,348 KB |
testcase_33 | AC | 1 ms
4,348 KB |
testcase_34 | AC | 1 ms
4,348 KB |
testcase_35 | AC | 2 ms
4,348 KB |
testcase_36 | AC | 1 ms
4,348 KB |
testcase_37 | AC | 2 ms
4,348 KB |
ソースコード
#include <iostream> #include <iomanip> #include <vector> #include <algorithm> #include <numeric> #include <functional> #include <cmath> #include <queue> #include <stack> #include <set> #include <map> #include <sstream> #include <string> #define repd(i,a,b) for (int i=(a);i<(b);i++) #define rep(i,n) repd(i,0,n) #define var auto #define mod 1000000007 #define inf 2147483647 #define nil -1 #define mp make_pair typedef long long ll; using namespace std; template <typename T> inline void output(T a, int p) { if(p){ cout << fixed << setprecision(p) << a << "\n"; } else{ cout << a << "\n"; } } // end of template int dx[4] = {1, 0, -1, 0}; int dy[4] = {0, 1, 0, -1}; int main() { cin.tie(0); // source code int H, W, A, Sx, Sy, B, Gx, Gy; cin >> H >> W >> A >> Sy >> Sx >> B >> Gy >> Gx; vector<string> M(H); rep(i, H) cin >> M[i]; vector<vector<vector<int>>> P(H, vector<vector<int>> (W, vector<int>(4000))); queue<pair<pair<int, int>, int>> q; P[Sy][Sx][A] = 1; q.push(mp(mp(Sx, Sy), A)); while (!q.empty()) { var t = q.front(); var x = t.first.first; var y = t.first.second; var a = t.second; q.pop(); if (a != 0) { rep(i, 4){ if (x + dx[i] >= 0 && x + dx[i] < W && y + dy[i] >= 0 && y + dy[i] < H && a + 1 < 20) { if (M[y + dy[i]][x + dx[i]] == '*' && P[y + dy[i]][x + dx[i]][a + 1] != 1) { q.push(mp(mp(x + dx[i], y + dy[i]), a + 1)); P[y + dy[i]][x + dx[i]][a + 1] = 1; } else if(M[y + dy[i]][x + dx[i]] == '.' && P[y + dy[i]][x + dx[i]][a - 1] != 1){ q.push(mp(mp(x + dx[i], y + dy[i]), a - 1)); P[y + dy[i]][x + dx[i]][a - 1] = 1; } } } } } output(P[Gy][Gx][B] ? "Yes" : "No", 0); return 0; }