Submission #944477

# Submission time Handle Problem Language Result Execution time Memory
944477 2024-03-12T18:28:38 Z rahidilbayramli Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
1 ms 6748 KB
#include<bits/stdc++.h>
#include"crocodile.h"
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define vl vector<ll>
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define f first
#define s second
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int sz = 1e5+5;
vector<pii>g[sz];
int vis[sz], e[sz], k = 0, i;
ll dist[sz], maxx = 0;
void dijkstra(ll node)
{
    for(i = 0; i < sz; i++)
    {
        dist[i] = 1e16;
        vis[i] = 0;
    }
    priority_queue<pll>pq;
    pq.push({0, node});
    dist[node] = 0;
    while(!pq.empty())
    {
        ll a = pq.top().s;
        pq.pop();
        if(vis[a])
            continue;
        vis[a] = 1;
        for(auto [u, w] : g[a])
        {
            if(dist[u] > dist[a] + w)
            {
                dist[u] = dist[a] + w;
                pq.push({-dist[u], u});
            }
        }
    }
}
int travel_plan(int N, int M, int R[][2], int L[], int K, int P[])
{
    maxx = 0;
    for(i = 0; i < M; i++)
    {
        g[R[i][0]].pb({R[i][1], L[i]});
        g[R[i][1]].pb({R[i][0], L[i]});
    }
    dijkstra(0);
    for(i = 0; i < K; i++)
        e[P[i]] = 1;
    vl vect;
    for(i = 0; i < N; i++)
    {
        if(e[i])
            vect.pb(dist[i]);
    }
    sort(all(vect));
    return vect[vect.size()-2];
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 6748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 6748 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 6748 KB Output isn't correct
2 Halted 0 ms 0 KB -