Submission #900262

# Submission time Handle Problem Language Result Execution time Memory
900262 2024-01-08T02:58:27 Z Sir_Ahmed_Imran Crocodile's Underground City (IOI11_crocodile) C++17
100 / 100
1109 ms 100936 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
int dp[MAXN];
int dist[MAXN];
multiset<pair<int,int>> s;
vector<pair<int,int>> a[MAXN]; 
int travel_plan(int n,int m,int e[MAXM][2],int t[MAXM],int k,int P[MAXN]){
    int p,q;
    for(int i=0;i<n;i++)
        dist[i]=dp[i]=1e9+7;
    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]});
    }
    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])
                if(q+i.ss<dp[i.ff])
                    s.insert({q+i.ss,i.ff});
        }
    }
    return dp[0];
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6744 KB Output is correct
2 Correct 1 ms 7000 KB Output is correct
3 Correct 1 ms 6748 KB Output is correct
4 Correct 2 ms 6748 KB Output is correct
5 Correct 2 ms 6748 KB Output is correct
6 Correct 2 ms 6748 KB Output is correct
7 Correct 2 ms 6748 KB Output is correct
8 Correct 2 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6744 KB Output is correct
2 Correct 1 ms 7000 KB Output is correct
3 Correct 1 ms 6748 KB Output is correct
4 Correct 2 ms 6748 KB Output is correct
5 Correct 2 ms 6748 KB Output is correct
6 Correct 2 ms 6748 KB Output is correct
7 Correct 2 ms 6748 KB Output is correct
8 Correct 2 ms 6748 KB Output is correct
9 Correct 4 ms 7000 KB Output is correct
10 Correct 1 ms 6748 KB Output is correct
11 Correct 2 ms 6748 KB Output is correct
12 Correct 5 ms 7424 KB Output is correct
13 Correct 4 ms 7516 KB Output is correct
14 Correct 1 ms 7000 KB Output is correct
15 Correct 2 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 6744 KB Output is correct
2 Correct 1 ms 7000 KB Output is correct
3 Correct 1 ms 6748 KB Output is correct
4 Correct 2 ms 6748 KB Output is correct
5 Correct 2 ms 6748 KB Output is correct
6 Correct 2 ms 6748 KB Output is correct
7 Correct 2 ms 6748 KB Output is correct
8 Correct 2 ms 6748 KB Output is correct
9 Correct 4 ms 7000 KB Output is correct
10 Correct 1 ms 6748 KB Output is correct
11 Correct 2 ms 6748 KB Output is correct
12 Correct 5 ms 7424 KB Output is correct
13 Correct 4 ms 7516 KB Output is correct
14 Correct 1 ms 7000 KB Output is correct
15 Correct 2 ms 6748 KB Output is correct
16 Correct 1109 ms 82376 KB Output is correct
17 Correct 57 ms 16720 KB Output is correct
18 Correct 79 ms 18000 KB Output is correct
19 Correct 1089 ms 93768 KB Output is correct
20 Correct 408 ms 100936 KB Output is correct
21 Correct 32 ms 10324 KB Output is correct
22 Correct 404 ms 52692 KB Output is correct