Submission #900252

# Submission time Handle Problem Language Result Execution time Memory
900252 2024-01-08T02:43:35 Z Sir_Ahmed_Imran Crocodile's Underground City (IOI11_crocodile) C++17
0 / 100
2 ms 6748 KB
                              ///~~~LOTA~~~///
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long 
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define MAXN 100000
#define MAXM 1000000
ll dp[MAXN];
ll dist[MAXN];
vector<pair<int,ll>> a[MAXN]; 
int travel_plan(int n,int m,int e[MAXM][2],int t[MAXM],int k,int P[MAXN]){
    ll q;
    int p;
    for(int i=0;i<n;i++)
        dist[i]=dp[i]=1e17;
    for(int i=0;i<m;i++){
        a[e[i][0]].append({e[i][1],t[i]});
        a[e[i][1]].append({e[i][0],t[i]});
    }
    set<pair<ll,int>> s;
    for(int i=0;i<k;i++){
        dist[P[i]]=0;
        s.insert({0,P[i]});
    }
    while(!s.empty()){
        p=(*s.begin()).ss;
        q=(*s.begin()).ff;
        s.erase(s.begin());
        if(q<dist[p])
            dist[p]=q;
        else if(q<dp[p]){
            dp[p]=q;
            for(auto& i:a[p])
                s.insert({q+i.ss,i.ff});
        }
    }
    if(dp[0]==1e17) dp[0]=-1;
    return dp[0];
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6744 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Correct 2 ms 6748 KB Output is correct
4 Incorrect 2 ms 6748 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6744 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Correct 2 ms 6748 KB Output is correct
4 Incorrect 2 ms 6748 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6744 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Correct 2 ms 6748 KB Output is correct
4 Incorrect 2 ms 6748 KB Output isn't correct
5 Halted 0 ms 0 KB -