結果

問題 No.323 yuki国
ユーザー h_nosonh_noson
提出日時 2016-06-10 00:32:19
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,391 bytes
コンパイル時間 734 ms
コンパイル使用メモリ 74,296 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-17 15:15:03
合計ジャッジ時間 3,846 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 48 ms
6,944 KB
testcase_09 AC 46 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 WA -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 41 ms
6,944 KB
testcase_16 RE -
testcase_17 AC 53 ms
6,940 KB
testcase_18 AC 11 ms
6,940 KB
testcase_19 AC 36 ms
6,944 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 49 ms
6,944 KB
testcase_25 AC 46 ms
6,944 KB
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 59 ms
6,940 KB
testcase_29 RE -
testcase_30 AC 2 ms
6,940 KB
testcase_31 AC 1 ms
6,940 KB
testcase_32 AC 1 ms
6,944 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 2 ms
6,944 KB
testcase_35 AC 1 ms
6,944 KB
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,s,e) for (i = s; i <= e; i++)
#define rep(i,n) REP (i,0,(int)(n)-1)
#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP (i,(int)(n)-1,0)
#define INF (int)1e8
#define MOD (int)(1e9+7)

typedef long long ll;

bool arrive[50][50][1251];
int dxy[4] = {-1,0,1,0};

int main(void) {
    int i, j, h, w, a, b, si, sj, gi, gj;
    string m[50];
    cin >> h >> w;
    cin >> a >> si >> sj;
    cin >> b >> gi >> gj;
    rep (i,h) cin >> m[i];

    queue<pair<pair<int,int>,int>> q;
    arrive[si][sj][a] = true;
    q.push(make_pair(make_pair(si,sj),a));
    while (!q.empty()) {
        int x = q.front().first.first;
        int y = q.front().first.second;
        int size = q.front().second;
        q.pop();
        rep (i,4) {
            int nx = x + dxy[i];
            int ny = y + dxy[(i+1)%4];
            if (nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
            int nsize = size + (m[nx][ny] == '*' ? 1 : -1);
            if (nsize > 0 && nsize <= b + h * w && !arrive[nx][ny][nsize]) {
                arrive[nx][ny][nsize] = true;
                q.push(make_pair(make_pair(nx,ny),nsize));
            }
        }
    }

    if (arrive[gi][gj][b])
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}
0