Submission #318381

# Submission time Handle Problem Language Result Execution time Memory
318381 2020-11-01T15:44:41 Z neki Crocodile's Underground City (IOI11_crocodile) C++14
100 / 100
603 ms 75076 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 vis[mn];
int travel_plan(int n,int m,int r[][2],int l[],int k,int p[]){
    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]));
    }
    priority_queue<pa> q;loop(i, 0, k) q.emplace(0, p[i]), vis[p[i]]=1;
    while(q.size()){
        ll u=q.top().se, d=q.top().fi;q.pop();
        if(vis[u]++ ==1){
            if(u==0) return -d;
            fore(v, edg[u]) q.emplace(d-v.se, v.fi);
        }
    }
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:30:24: warning: control reaches end of non-void function [-Wreturn-type]
   30 |     priority_queue<pa> q;loop(i, 0, k) q.emplace(0, p[i]), vis[p[i]]=1;
      |                        ^
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5228 KB Output is correct
2 Correct 4 ms 5100 KB Output is correct
3 Correct 4 ms 5100 KB Output is correct
4 Correct 4 ms 5100 KB Output is correct
5 Correct 5 ms 5120 KB Output is correct
6 Correct 4 ms 5100 KB Output is correct
7 Correct 4 ms 5100 KB Output is correct
8 Correct 5 ms 5100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5228 KB Output is correct
2 Correct 4 ms 5100 KB Output is correct
3 Correct 4 ms 5100 KB Output is correct
4 Correct 4 ms 5100 KB Output is correct
5 Correct 5 ms 5120 KB Output is correct
6 Correct 4 ms 5100 KB Output is correct
7 Correct 4 ms 5100 KB Output is correct
8 Correct 5 ms 5100 KB Output is correct
9 Correct 7 ms 5484 KB Output is correct
10 Correct 5 ms 5132 KB Output is correct
11 Correct 5 ms 5228 KB Output is correct
12 Correct 9 ms 5900 KB Output is correct
13 Correct 7 ms 5996 KB Output is correct
14 Correct 4 ms 5100 KB Output is correct
15 Correct 6 ms 5100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5228 KB Output is correct
2 Correct 4 ms 5100 KB Output is correct
3 Correct 4 ms 5100 KB Output is correct
4 Correct 4 ms 5100 KB Output is correct
5 Correct 5 ms 5120 KB Output is correct
6 Correct 4 ms 5100 KB Output is correct
7 Correct 4 ms 5100 KB Output is correct
8 Correct 5 ms 5100 KB Output is correct
9 Correct 7 ms 5484 KB Output is correct
10 Correct 5 ms 5132 KB Output is correct
11 Correct 5 ms 5228 KB Output is correct
12 Correct 9 ms 5900 KB Output is correct
13 Correct 7 ms 5996 KB Output is correct
14 Correct 4 ms 5100 KB Output is correct
15 Correct 6 ms 5100 KB Output is correct
16 Correct 561 ms 75076 KB Output is correct
17 Correct 92 ms 15716 KB Output is correct
18 Correct 102 ms 17252 KB Output is correct
19 Correct 603 ms 69468 KB Output is correct
20 Correct 370 ms 68416 KB Output is correct
21 Correct 54 ms 10084 KB Output is correct
22 Correct 597 ms 48936 KB Output is correct