結果

問題 No.1190 Points
ユーザー ChanyuhChanyuh
提出日時 2020-08-23 12:04:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,421 bytes
コンパイル時間 1,739 ms
コンパイル使用メモリ 137,536 KB
実行使用メモリ 23,440 KB
最終ジャッジ日時 2024-04-23 17:32:45
合計ジャッジ時間 8,957 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 162 ms
16,944 KB
testcase_04 AC 114 ms
15,512 KB
testcase_05 AC 156 ms
13,984 KB
testcase_06 AC 157 ms
20,736 KB
testcase_07 AC 243 ms
21,700 KB
testcase_08 WA -
testcase_09 AC 288 ms
21,448 KB
testcase_10 AC 290 ms
21,348 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Per(i,sta,n) for(int i=n-1;i>=sta;i--)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, int> LP;
int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};

template <typename T>
vector<T> dijkstra(int s,vector<vector<pair<T,int>>> & G){
    const T inf=numeric_limits<T>::max();
    using edge=pair<T,int>;
    priority_queue<edge, vector<edge>, greater<edge> > que;
    int n=G.size();
    vector<T> d(n,inf);
    vector<int> b(n,-1);
    d[s]=0;
    que.emplace(d[s],s);
    while (!que.empty()){
        edge p = que.top(); que.pop();
        int v = p.second;
        if (d[v]<p.first) continue;
        for(auto& e:G[v]){
            int u=e.second;
            T c=e.first;
            if (d[u]>d[v]+c){
                d[u]=d[v]+c;
                b[u]=v;
                que.emplace(d[u],u);
            }
        }
    }
    return d;
}

int n,m,p;
int s,g;

void solve(){
    cin >> n >> m >> p;
    cin >> s >> g;s--;g--;
    vector<vector<LP>> G(2*n);
    rep(i,m){
        int u,v;cin >> u >> v;u--;v--;
        rep(j,2){
            G[2*v+j].push_back(LP(1,2*u+1-j));
            G[2*u+j].push_back(LP(1,2*v+1-j));
        }
    }
    vector<ll> ds=dijkstra(2*s,G),dg=dijkstra(2*g+p%2,G);
    vector<int> ans={};
    rep(i,n){
        ll mi1=min(ds[2*i],ds[2*i+1]),mi2=min(dg[2*i],dg[2*i+1]);
        if(mi1+mi2<=p){
            ans.push_back(i+1);
        }
    }
    cout << ans.size() << endl;
    rep(i,ans.size()){
        cout << ans[i] << endl;
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}
0