結果

問題 No.323 yuki国
ユーザー 37kt_37kt_
提出日時 2016-04-25 10:50:20
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 840 bytes
コンパイル時間 1,231 ms
コンパイル使用メモリ 168,012 KB
実行使用メモリ 9,688 KB
最終ジャッジ日時 2024-04-15 04:26:35
合計ジャッジ時間 4,116 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 2 ms
6,816 KB
testcase_03 AC 4 ms
6,944 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 WA -
testcase_07 AC 1 ms
6,948 KB
testcase_08 AC 100 ms
9,600 KB
testcase_09 AC 101 ms
9,472 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 102 ms
9,344 KB
testcase_14 AC 102 ms
9,600 KB
testcase_15 AC 47 ms
9,600 KB
testcase_16 AC 98 ms
9,600 KB
testcase_17 AC 120 ms
9,600 KB
testcase_18 AC 32 ms
6,940 KB
testcase_19 AC 69 ms
7,296 KB
testcase_20 AC 145 ms
9,472 KB
testcase_21 AC 147 ms
9,552 KB
testcase_22 AC 147 ms
9,688 KB
testcase_23 AC 146 ms
9,472 KB
testcase_24 AC 54 ms
9,600 KB
testcase_25 AC 57 ms
9,600 KB
testcase_26 AC 130 ms
9,600 KB
testcase_27 AC 123 ms
9,472 KB
testcase_28 AC 124 ms
9,600 KB
testcase_29 AC 124 ms
9,472 KB
testcase_30 AC 1 ms
6,944 KB
testcase_31 AC 2 ms
6,944 KB
testcase_32 AC 2 ms
6,940 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 2 ms
6,944 KB
testcase_37 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

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

int n, m;
int a, sx, sy, b, gx, gy;
string c[50];
bool vis[50][50][2510];

int main(){
  cin >> n >> m >> a >> sx >> sy >> b >> gx >> gy;
  for (int i = 0; i < n; i++) cin >> c[i];

  queue<tuple<int, int, int>> q;
  vis[sx][sy][a] = true;
  q.emplace(sx, sy, a);
  while (q.size()){
    int x, y, s;
    tie(x, y, s) = q.front();
    q.pop();
    for (int i = 0; i < 4; i++){
      int nx = x + dx[i];
      int ny = y + dy[i];
      if (nx < 0 || n <= nx || ny < 0 || m <= ny) continue;
      int ns = s + (c[nx][ny] == '*' ? 1 : -1);
      if (ns < 0 || ns > 2510) continue;
      if (vis[nx][ny][ns]) continue;
      vis[nx][ny][ns] = true;
      q.emplace(nx, ny, ns);
    }
  }

  cout << (vis[gx][gy][b] ? "Yes\n" : "No\n");
}
0