답안 #318376

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
318376 2020-11-01T15:09:11 Z neki 악어의 지하 도시 (IOI11_crocodile) C++14
0 / 100
5 ms 5120 KB
#include <bits/stdc++.h>
#include "crocodile.h"
#define fore(i, a) for(auto&& i:a)
#define fi first
#define se second
#define ps(a) push_back(a)
#define pb(a) pop_back(a)
#define sc scanf
#define vc vector
#define pa pair<ll, ll>
#define ll int
#define loop(i, a, b) for(ll i=a;i<b;i++)
#define pool(i, a, b) for(ll i=a-1;i>=b;i--)
#define lb lower_bound
#define ub upper_bound
#define all(a) a.begin(), a.end()
#define llmax LLONG_MAX/2
#define llmin -LLONG_MAX/2
using namespace std;
#define mn 200100
#define pa pair<ll, ll>
#define ld long double
vc<pa> edg[mn];
ll act[mn], dist[mn], vis[mn];
int travel_plan(int n,int m,int r[][2],int l[],int k,int p[]){
    loop(i, 0, n) dist[i]=-1;
    loop(i, 0, m){
        edg[r[i][0]].ps(make_pair(r[i][1], l[i]));
        edg[r[i][1]].ps(make_pair(r[i][0], l[i]));
    }
    set<pair<ll, ll>> q;loop(i, 0, k) q.insert({0, p[i]}), act[p[i]]=1, dist[p[i]]=0;
    while(q.size()){
        ll u=q.begin()->se, d=q.begin()->fi;
        //cout << u << " "<<q.begin()->fi<<endl;
        q.erase(q.begin());
        
        if(vis[u])continue;
        if(!act[u]) act[u]=1;
        else{
            vis[u]=1;
            dist[u]=d;
            fore(v, edg[u]) q.insert({dist[u]+v.se, v.fi});
        }
    }
    return  dist[0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5100 KB Output is correct
2 Correct 4 ms 5100 KB Output is correct
3 Correct 4 ms 5120 KB Output is correct
4 Incorrect 5 ms 5100 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5100 KB Output is correct
2 Correct 4 ms 5100 KB Output is correct
3 Correct 4 ms 5120 KB Output is correct
4 Incorrect 5 ms 5100 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5100 KB Output is correct
2 Correct 4 ms 5100 KB Output is correct
3 Correct 4 ms 5120 KB Output is correct
4 Incorrect 5 ms 5100 KB Output isn't correct
5 Halted 0 ms 0 KB -