結果

問題 No.2674 k-Walk on Bipartite
ユーザー Tatsu_mrTatsu_mr
提出日時 2024-03-15 21:56:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 870 bytes
コンパイル時間 2,366 ms
コンパイル使用メモリ 209,328 KB
実行使用メモリ 13,792 KB
最終ジャッジ日時 2024-03-15 21:56:17
合計ジャッジ時間 5,878 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 WA -
testcase_05 WA -
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 106 ms
12,044 KB
testcase_08 AC 142 ms
10,240 KB
testcase_09 WA -
testcase_10 AC 177 ms
11,520 KB
testcase_11 WA -
testcase_12 AC 179 ms
10,368 KB
testcase_13 WA -
testcase_14 AC 23 ms
8,320 KB
testcase_15 AC 187 ms
12,420 KB
testcase_16 AC 125 ms
12,552 KB
testcase_17 AC 132 ms
9,856 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 120 ms
11,708 KB
testcase_21 AC 142 ms
10,624 KB
testcase_22 WA -
testcase_23 AC 2 ms
6,676 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 2 ms
6,676 KB
testcase_27 WA -
testcase_28 AC 2 ms
6,676 KB
testcase_29 AC 2 ms
6,676 KB
testcase_30 WA -
testcase_31 AC 2 ms
6,676 KB
testcase_32 AC 2 ms
6,676 KB
testcase_33 AC 2 ms
6,676 KB
testcase_34 AC 2 ms
6,676 KB
testcase_35 AC 2 ms
6,676 KB
testcase_36 AC 2 ms
6,676 KB
testcase_37 AC 2 ms
6,676 KB
testcase_38 AC 2 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int n, m, s, t, k;
    cin >> n >> m >> s >> t >> k;
    s--;
    t--;
    vector<vector<int>> g(n);
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<int> dist(n, -1);
    queue<int> q;
    dist[s] = 0;
    q.push(s);
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (int nv : g[v]) {
            if (dist[nv] != -1) {
                continue;
            }
            dist[nv] = dist[v] + 1;
            q.push(nv);
        }
    }
    if (abs(dist[t] - k) % 2 == 0) {
        if (dist[t] <= k) {
            cout << "Yes" << endl;
        } else {
            cout << "Unknown" << endl;
        }
    } else {
        cout << "No" << endl;
    }
}
0