結果

問題 No.323 yuki国
ユーザー motimoti
提出日時 2015-12-16 00:39:42
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,933 bytes
コンパイル時間 1,003 ms
コンパイル使用メモリ 108,900 KB
実行使用メモリ 247,416 KB
最終ジャッジ日時 2023-10-14 10:29:40
合計ジャッジ時間 8,676 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
17,276 KB
testcase_01 AC 9 ms
17,288 KB
testcase_02 AC 9 ms
17,456 KB
testcase_03 AC 9 ms
17,348 KB
testcase_04 AC 9 ms
17,272 KB
testcase_05 AC 13 ms
18,380 KB
testcase_06 AC 10 ms
17,716 KB
testcase_07 AC 9 ms
17,320 KB
testcase_08 AC 68 ms
33,212 KB
testcase_09 WA -
testcase_10 AC 9 ms
17,448 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 186 ms
63,940 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 20 ms
20,108 KB
testcase_19 AC 389 ms
113,240 KB
testcase_20 AC 38 ms
25,064 KB
testcase_21 AC 861 ms
228,420 KB
testcase_22 WA -
testcase_23 AC 821 ms
218,252 KB
testcase_24 AC 358 ms
103,636 KB
testcase_25 AC 363 ms
106,308 KB
testcase_26 AC 330 ms
98,256 KB
testcase_27 AC 367 ms
107,780 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 9 ms
17,332 KB
testcase_31 AC 9 ms
17,524 KB
testcase_32 AC 11 ms
17,724 KB
testcase_33 AC 9 ms
17,324 KB
testcase_34 AC 12 ms
18,124 KB
testcase_35 AC 9 ms
17,324 KB
testcase_36 AC 11 ms
17,704 KB
testcase_37 AC 9 ms
17,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define minimize(a, x) a = std::min(a, x)
#define maximize(a, x) a = std::max(a, x)

typedef long long ll;
int const inf = 1<<29;

int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};

template<class T> constexpr bool in_range(T y, T x, T H, T W) { return 0<=y&&y<H&&0<=x&&x<W; }

unordered_set<int> G[102][50][50];
//set<int> G[2002][50][50];

int main() {

  int H, W; cin >> H >> W;
  int A, si, sj; cin >> A >> si >> sj;
  int B, gi, gj; cin >> B >> gi >> gj;

  vector<string> yuki(H);
  rep(i, H) {
    cin >> yuki[i];
  }

  G[0][si][sj].insert(A);

  rep(k, 101) {
//    rep(i, H) rep(j, W) G[(k+1)&1][i][j].clear();
    rep(i, H) rep(j, W) {
      if(i == gi && j == gj && G[k][i][j].count(B)) {
        cout << "Yes" << endl;
        exit(0);
      }
      for(auto const& e: G[k][i][j]) {
        if(e - 1 < 0) { continue; }
        rep(d, 4) {
          auto const ni = i + dy[d], nj = j + dx[d];
          if(!in_range(ni, nj, H, W)) { continue; }
//          if(yuki[ni][nj] == '*') { cout << "ok\n"; }
          G[k+1][ni][nj].insert(e + (yuki[ni][nj] == '*' ? 1 : -1));
        }
      }
    }
    /*
    rep(i, H) {
      rep(j, W) {
        cout << (G[k][i][j].empty() ? 0 : *G[k][i][j].begin()) << " ";
      }
      cout << endl;
    }
    cout << "\n-------------------\n";
    */
  }

  cout << "No" << endl;

  return 0;
}
0