結果

問題 No.2646 Cycle Maze
ユーザー GOTKAKOGOTKAKO
提出日時 2024-02-27 07:56:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,240 bytes
コンパイル時間 2,535 ms
コンパイル使用メモリ 214,392 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-27 07:56:54
合計ジャッジ時間 12,194 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 WA -
testcase_07 AC 2 ms
6,676 KB
testcase_08 AC 2 ms
6,676 KB
testcase_09 AC 2 ms
6,676 KB
testcase_10 AC 2 ms
6,676 KB
testcase_11 AC 2 ms
6,676 KB
testcase_12 WA -
testcase_13 AC 2 ms
6,676 KB
testcase_14 AC 2 ms
6,676 KB
testcase_15 AC 2 ms
6,676 KB
testcase_16 WA -
testcase_17 AC 2 ms
6,676 KB
testcase_18 WA -
testcase_19 AC 2 ms
6,676 KB
testcase_20 AC 2 ms
6,676 KB
testcase_21 AC 2 ms
6,676 KB
testcase_22 AC 2 ms
6,676 KB
testcase_23 AC 2 ms
6,676 KB
testcase_24 AC 2 ms
6,676 KB
testcase_25 AC 276 ms
6,676 KB
testcase_26 AC 183 ms
6,676 KB
testcase_27 AC 178 ms
6,676 KB
testcase_28 AC 38 ms
6,676 KB
testcase_29 AC 301 ms
6,676 KB
testcase_30 AC 195 ms
6,676 KB
testcase_31 AC 119 ms
6,676 KB
testcase_32 AC 2 ms
6,676 KB
testcase_33 AC 10 ms
6,676 KB
testcase_34 AC 29 ms
6,676 KB
testcase_35 AC 153 ms
6,676 KB
testcase_36 AC 14 ms
6,676 KB
testcase_37 AC 44 ms
6,676 KB
testcase_38 AC 36 ms
6,676 KB
testcase_39 AC 188 ms
6,676 KB
testcase_40 AC 93 ms
6,676 KB
testcase_41 AC 153 ms
6,676 KB
testcase_42 AC 19 ms
6,676 KB
testcase_43 AC 19 ms
6,676 KB
testcase_44 AC 71 ms
6,676 KB
testcase_45 AC 188 ms
6,676 KB
testcase_46 AC 234 ms
6,676 KB
testcase_47 AC 906 ms
6,676 KB
testcase_48 AC 177 ms
6,676 KB
testcase_49 AC 898 ms
6,676 KB
testcase_50 AC 205 ms
6,676 KB
testcase_51 AC 478 ms
6,676 KB
testcase_52 AC 564 ms
6,676 KB
testcase_53 AC 812 ms
6,676 KB
testcase_54 AC 809 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int H,W,T; cin >> H >> W >> T;
    int sx,sy,gx,gy; cin >> sx >> sy >> gx >> gy;
    sx--; sy--; gx--; gy--;

    vector<vector<bool>> ok(H,vector<bool>(W));
    vector<vector<int>> A(H,vector<int>(W));
    for(int i=0; i<H; i++) for(int k=0; k<W; k++){
        char c; cin >> c;
        A.at(i).at(k) = c-'0'+1;
    }
    ok.at(sx).at(sy) = true;

    bool yes = false;
    vector<int> dx = {-1,0,1,0},dy = {0,1,0,-1};
    for(int i=1; i<=T; i++){
        vector<vector<bool>> next(H,vector<bool>(W));
        for(int x=0; x<H; x++) for(int y=0; y<W; y++){
            if(!ok.at(x).at(y)) continue;
            for(int k=0; k<4; k++){
                int nx = x+dx.at(k),ny = y+dy.at(k);
                if(nx < 0 || nx >= H || ny < 0 || ny >= W) continue;
                if(next.at(nx).at(ny)) continue;
                
                if((i+1)%A.at(nx).at(ny)) next.at(nx).at(ny) = true;
            }
            if((i+1)%A.at(x).at(y)) next.at(x).at(y) = true;
        }
        swap(ok,next);
        if(ok.at(gx).at(gy)) yes = true;
    }
    if(yes) cout << "Yes" << endl;
    else cout << "No" << endl;
}
0