結果

問題 No.323 yuki国
ユーザー mayoko_mayoko_
提出日時 2015-12-16 21:34:04
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,700 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 9,564 KB
最終ジャッジ日時 2023-10-14 11:05:36
合計ジャッジ時間 4,012 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 9 ms
9,480 KB
testcase_02 AC 9 ms
9,264 KB
testcase_03 AC 11 ms
9,528 KB
testcase_04 AC 9 ms
9,296 KB
testcase_05 AC 10 ms
9,208 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 60 ms
9,332 KB
testcase_09 AC 59 ms
9,272 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 8 ms
9,244 KB
testcase_12 AC 5 ms
7,496 KB
testcase_13 AC 61 ms
9,216 KB
testcase_14 AC 63 ms
9,412 KB
testcase_15 AC 32 ms
7,488 KB
testcase_16 AC 64 ms
9,564 KB
testcase_17 AC 74 ms
9,352 KB
testcase_18 AC 29 ms
9,348 KB
testcase_19 AC 53 ms
9,244 KB
testcase_20 AC 136 ms
9,320 KB
testcase_21 AC 139 ms
9,372 KB
testcase_22 AC 140 ms
9,496 KB
testcase_23 AC 137 ms
9,312 KB
testcase_24 AC 47 ms
7,412 KB
testcase_25 AC 45 ms
7,476 KB
testcase_26 AC 91 ms
9,196 KB
testcase_27 AC 97 ms
9,348 KB
testcase_28 AC 81 ms
9,224 KB
testcase_29 AC 82 ms
9,300 KB
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 9 ms
9,252 KB
testcase_32 AC 9 ms
9,396 KB
testcase_33 AC 8 ms
9,380 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 9 ms
9,216 KB
testcase_37 AC 8 ms
9,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
#include<complex>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>

const int dx[] = {1, 0, -1, 0};
const int dy[] = {0, 1, 0, -1};
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

struct State {
    int size;
    int y;
    int x;
    State() {}
    State(int size, int y, int x) : size(size), y(y), x(x) {}
};
bool done[2000][55][55];
string field[55];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int H, W;
    cin >> H >> W;
    int A, Si, Sj;
    cin >> A >> Si >> Sj;
    int B, Gi, Gj;
    cin >> B >> Gi >> Gj;
    for (int i = 0; i < H; i++) cin >> field[i];
    queue<State> que;
    que.push(State(A, Si, Sj));
    done[A][Si][Sj] = true;
    while (!que.empty()) {
        State s = que.front(); que.pop();
        for (int k = 0; k < 4; k++) {
            int ny = s.y+dy[k];
            int nx = s.x+dx[k];
            if (ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
            int nsize = s.size;
            if (field[ny][nx] == '*') nsize++;
            else nsize--;
            if (nsize < 0 || nsize >= 2000) continue;
            if (done[nsize][ny][nx]) continue;
            done[nsize][ny][nx] = true;
            que.push(State(nsize, ny, nx));
        }
    }
    if (done[B][Gi][Gj]) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}
0