Submission #318379

# Submission time Handle Problem Language Result Execution time Memory
318379 2020-11-01T15:21:14 Z neki Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
5 ms 5228 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 long long
#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;
        q.erase(q.begin());
        
        if(vis[u])continue;
        if(!act[u]) act[u]=1;
        else{
            vis[u]=1;
            if(u==0) return d;
            dist[u]=d;
            fore(v, edg[u]) q.insert({dist[u]+v.se, v.fi});
        }
    }
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:31:23: warning: control reaches end of non-void function [-Wreturn-type]
   31 |     set<pair<ll, ll>> q;loop(i, 0, k) q.insert({0, p[i]}), act[p[i]]=1, dist[p[i]]=0;
      |                       ^
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5120 KB Output is correct
2 Correct 4 ms 5100 KB Output is correct
3 Correct 4 ms 5100 KB Output is correct
4 Incorrect 5 ms 5228 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5120 KB Output is correct
2 Correct 4 ms 5100 KB Output is correct
3 Correct 4 ms 5100 KB Output is correct
4 Incorrect 5 ms 5228 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5120 KB Output is correct
2 Correct 4 ms 5100 KB Output is correct
3 Correct 4 ms 5100 KB Output is correct
4 Incorrect 5 ms 5228 KB Output isn't correct
5 Halted 0 ms 0 KB -