Submission #944475

# Submission time Handle Problem Language Result Execution time Memory
944475 2024-03-12T18:22:33 Z rahidilbayramli Crocodile's Underground City (IOI11_crocodile) C++17
100 / 100
424 ms 93452 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)
{
    priority_queue<pll>pq;
    for(i = 0; i < sz; i++)
    {
        if(vis[i] == 1)
            pq.push({0, i});
    }
    while(!pq.empty())
    {
        ll x = pq.top().f;
        ll a = pq.top().s;
        pq.pop();
        vis[a]++;
        if(vis[a] == 2){
            if(a == 0)
            {
                maxx = -x;
                return;
            }
            for(auto [u, w] : g[a])
                pq.push({x - w, 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]});
    }
    for(i = 0; i < K; i++)
        vis[P[i]] = 1;
    dijkstra(1);
    return maxx;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 1 ms 6744 KB Output is correct
3 Correct 2 ms 6624 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6488 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Correct 2 ms 6488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 1 ms 6744 KB Output is correct
3 Correct 2 ms 6624 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6488 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Correct 2 ms 6488 KB Output is correct
9 Correct 3 ms 9052 KB Output is correct
10 Correct 2 ms 6492 KB Output is correct
11 Correct 2 ms 6608 KB Output is correct
12 Correct 6 ms 9436 KB Output is correct
13 Correct 4 ms 9688 KB Output is correct
14 Correct 2 ms 6576 KB Output is correct
15 Correct 2 ms 6492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6492 KB Output is correct
2 Correct 1 ms 6744 KB Output is correct
3 Correct 2 ms 6624 KB Output is correct
4 Correct 2 ms 6492 KB Output is correct
5 Correct 2 ms 6492 KB Output is correct
6 Correct 2 ms 6488 KB Output is correct
7 Correct 2 ms 6492 KB Output is correct
8 Correct 2 ms 6488 KB Output is correct
9 Correct 3 ms 9052 KB Output is correct
10 Correct 2 ms 6492 KB Output is correct
11 Correct 2 ms 6608 KB Output is correct
12 Correct 6 ms 9436 KB Output is correct
13 Correct 4 ms 9688 KB Output is correct
14 Correct 2 ms 6576 KB Output is correct
15 Correct 2 ms 6492 KB Output is correct
16 Correct 331 ms 93452 KB Output is correct
17 Correct 59 ms 18512 KB Output is correct
18 Correct 62 ms 19996 KB Output is correct
19 Correct 351 ms 80800 KB Output is correct
20 Correct 240 ms 87044 KB Output is correct
21 Correct 33 ms 14412 KB Output is correct
22 Correct 424 ms 52532 KB Output is correct