結果

問題 No.2674 k-Walk on Bipartite
ユーザー tour2sttour2st
提出日時 2024-03-15 23:10:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,015 bytes
コンパイル時間 929 ms
コンパイル使用メモリ 98,424 KB
実行使用メモリ 16,320 KB
最終ジャッジ日時 2024-03-15 23:10:16
合計ジャッジ時間 4,708 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,512 KB
testcase_01 AC 4 ms
8,512 KB
testcase_02 WA -
testcase_03 AC 4 ms
8,512 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 4 ms
8,512 KB
testcase_07 AC 108 ms
12,992 KB
testcase_08 AC 152 ms
14,656 KB
testcase_09 AC 93 ms
12,096 KB
testcase_10 AC 183 ms
15,808 KB
testcase_11 AC 114 ms
13,120 KB
testcase_12 AC 215 ms
15,680 KB
testcase_13 AC 85 ms
11,840 KB
testcase_14 AC 21 ms
9,536 KB
testcase_15 AC 200 ms
16,320 KB
testcase_16 AC 131 ms
13,760 KB
testcase_17 AC 142 ms
14,272 KB
testcase_18 AC 52 ms
10,688 KB
testcase_19 AC 111 ms
12,352 KB
testcase_20 AC 95 ms
12,608 KB
testcase_21 AC 185 ms
14,656 KB
testcase_22 AC 206 ms
16,320 KB
testcase_23 AC 4 ms
8,512 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 4 ms
8,512 KB
testcase_27 AC 4 ms
8,512 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 4 ms
8,512 KB
testcase_31 AC 4 ms
8,512 KB
testcase_32 AC 4 ms
8,512 KB
testcase_33 AC 4 ms
8,512 KB
testcase_34 AC 4 ms
8,512 KB
testcase_35 AC 5 ms
8,512 KB
testcase_36 AC 4 ms
8,512 KB
testcase_37 AC 4 ms
8,512 KB
testcase_38 AC 4 ms
8,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <random>
#include <time.h>
#include <map>
using namespace std;

int n,m,s,t,k,a,b;
vector<int>e[200000];
int length[200000];
bool visited[200000];

void dfs(int now, int len=0)
{
    if(visited[now]) return;
    visited[now]=true;
    length[now]=len;
    for(int nxt:e[now]) dfs(nxt, len+1);
}

int main()
{
    cin >> n >> m >> s >> t >> k;
    for(int i=0;i<m;i++)
    {
        cin >> a >> b;
        a--;b--;
        e[a].push_back(b);
        e[b].push_back(a);
    }
    s--;t--;
    dfs(s);
    if(visited[t])
    {
        if(length[t]%2!=k%2)
        {
            cout << "No" << endl;
        }
        else
        {
            if(length[t]<=k)
            {
                cout << "Yes" << endl;
            }
            else
            {
                cout << "Yes" << endl;
            }
        }
    }
    else
    {
        cout << "Unknown" << endl;
    }
}
0