Submission #388921

# Submission time Handle Problem Language Result Execution time Memory
388921 2021-04-13T09:58:24 Z Killer2501 Crocodile's Underground City (IOI11_crocodile) C++14
0 / 100
20 ms 10060 KB
#include <bits/stdc++.h>
#define ll long long
#include "crocodile.h"
#define pb push_back
#define task "asd"
#define pll pair<ll, ll>
#define pii pair<pll, ll>
#define fi first
#define se second

using namespace std;
const ll mod = 1e17+7;
const ll N = 2e5+5;
const int base = 313;
const long double Exp = 1e-8;
ll n, m, t, k, T, ans, tong, c[N];
ll a[N], b[N], d[N][2];
vector<pll> adj[N];
vector<pll> kq;
string s;

int travel_plan(int n, int m, int r[][2], int l[], int k, int p[])
{
    for(int i = 0; i < m; i ++)
    {
        ll x, y, z;
        x = r[i][1];
        y = r[i][0];
        z = l[i];
        adj[x].pb({z, y});
        adj[y].pb({z, x});
    }
    priority_queue< pll, vector<pll>, greater<pll> > pq;
    for(int i = 0; i < n; i ++)d[i][0] = d[i][1] = mod;
    for(int i = 0; i < k; i ++)
    {
        ll x = p[i];
        d[x][1] = 0;
        a[x] = 1;
        pq.push({0, x});
    }
    while(!pq.empty())
    {
        pll u = pq.top();
        pq.pop();
        if(a[u.se] == 0)
        {
            a[u.se] = 1;
            continue;
        }
        if(u.se == 0)
        {
            return u.fi;
        }
        for(pll v : adj[u.se])
        {
            ll val = v.fi + u.fi;
            if(val <= d[v.se][0])
            {
                d[v.se][1] = d[v.se][0];
                d[v.se][0] = val;
                pq.push({d[v.se][1], v.se});
            }
            else if(val < d[v.se][1])
            {
                d[v.se][1] = val;
                pq.push({d[v.se][1], v.se});
            }
        }
    }
}

Compilation message

crocodile.cpp: In function 'int travel_plan(int, int, int (*)[2], int*, int, int*)':
crocodile.cpp:33:54: warning: control reaches end of non-void function [-Wreturn-type]
   33 |     priority_queue< pll, vector<pll>, greater<pll> > pq;
      |                                                      ^~
# Verdict Execution time Memory Grader output
1 Runtime error 20 ms 10060 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 20 ms 10060 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 20 ms 10060 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -