結果

問題 No.323 yuki国
ユーザー parukiparuki
提出日時 2016-06-29 11:53:20
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,436 bytes
コンパイル時間 1,425 ms
コンパイル使用メモリ 171,600 KB
実行使用メモリ 12,388 KB
最終ジャッジ日時 2024-04-20 04:03:40
合計ジャッジ時間 4,623 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
12,000 KB
testcase_01 AC 4 ms
12,128 KB
testcase_02 AC 4 ms
12,128 KB
testcase_03 AC 4 ms
12,136 KB
testcase_04 AC 3 ms
12,180 KB
testcase_05 AC 5 ms
12,212 KB
testcase_06 WA -
testcase_07 AC 4 ms
12,152 KB
testcase_08 AC 174 ms
12,036 KB
testcase_09 AC 58 ms
12,256 KB
testcase_10 AC 4 ms
12,008 KB
testcase_11 AC 4 ms
12,004 KB
testcase_12 AC 3 ms
12,256 KB
testcase_13 AC 56 ms
12,240 KB
testcase_14 AC 177 ms
12,080 KB
testcase_15 AC 52 ms
12,220 KB
testcase_16 AC 122 ms
12,312 KB
testcase_17 AC 64 ms
12,104 KB
testcase_18 AC 5 ms
12,012 KB
testcase_19 AC 137 ms
12,388 KB
testcase_20 AC 7 ms
12,208 KB
testcase_21 AC 329 ms
12,348 KB
testcase_22 AC 31 ms
12,196 KB
testcase_23 AC 336 ms
12,212 KB
testcase_24 AC 11 ms
12,304 KB
testcase_25 AC 71 ms
12,200 KB
testcase_26 AC 9 ms
12,324 KB
testcase_27 AC 249 ms
12,276 KB
testcase_28 AC 76 ms
12,288 KB
testcase_29 AC 73 ms
12,208 KB
testcase_30 AC 4 ms
11,964 KB
testcase_31 AC 4 ms
12,240 KB
testcase_32 AC 5 ms
12,144 KB
testcase_33 AC 4 ms
12,136 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 4 ms
12,164 KB
testcase_37 AC 4 ms
11,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
const int DY[] = {-1,0,1,0};
const int DX[] = {0,1,0,-1};

typedef tuple<int, int, int> T;
int H, W;
bool vis[50][50][3501];
int A, SY, SX, B, GY, GX;
string M[50];

bool solve(){
    MEM(vis, 0);
    queue<T> Q;
    Q.push(T(A, SY, SX));
    while(sz(Q)){
        int tama, y, x;
        tie(tama, y, x) = Q.front();
        Q.pop();
        if(vis[y][x][tama])continue;
        vis[y][x][tama] = 1;
        if(y == GY&&x == GX&&tama == B)return 1;

        rep(i, 4){
            int ny = y + DY[i], nx = x + DX[i], ntama = tama;
            if(ny < 0 || ny>=H || nx<0 || nx>=W)continue;
            if(M[ny][nx] == '*')ntama++;
            else ntama--;
            if(ntama < 0 || ntama >= 3501)continue;
            Q.push(T(ntama, ny, nx));
        }
    }
    return 0;
}

int main(){
    while(cin >> H >> W >> A >> SY >> SX >> B >> GY >> GX){
        rep(y, H)cin >> M[y];
        puts(solve() ? "Yes" : "No");
    }
}
0