Submission #781137

# Submission time Handle Problem Language Result Execution time Memory
781137 2023-07-12T19:01:12 Z I_Love_EliskaM_ Crocodile's Underground City (IOI11_crocodile) C++14
100 / 100
688 ms 75444 KB
#include "crocodile.h"
#include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0; i<n; ++i)
#define pb push_back
#define all(x) x.begin(),x.end()
#define pi pair<int,int>
#define f first
#define s second

const int N=1e5+55;
vector<pi> adj[N];
int ok[N];
int d[N];
int vis[N];

int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]) {

  forn(i,m) {
    int u=r[i][0], v=r[i][1], w=l[i];
    adj[u].pb({v,w}), adj[v].pb({u,w});
  }

  priority_queue<pi> q;
  forn(i,k) q.push({0,p[i]}), vis[p[i]]=1;

  while (q.size()) {
    auto it=q.top(); q.pop();
    int di=-it.f, u=it.s;
    ++vis[u];
    if (vis[u]!=2) continue;
    d[u]=di;
    for(auto&e:adj[u]) {
      int v=e.f, w=e.s;
      q.push({-di-w,v});
    }
  }
  return d[0];

}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2668 KB Output is correct
4 Correct 2 ms 2772 KB Output is correct
5 Correct 2 ms 2684 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2668 KB Output is correct
4 Correct 2 ms 2772 KB Output is correct
5 Correct 2 ms 2684 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2676 KB Output is correct
9 Correct 5 ms 3128 KB Output is correct
10 Correct 1 ms 2644 KB Output is correct
11 Correct 2 ms 2772 KB Output is correct
12 Correct 6 ms 3540 KB Output is correct
13 Correct 6 ms 3540 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 3 ms 2772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2668 KB Output is correct
4 Correct 2 ms 2772 KB Output is correct
5 Correct 2 ms 2684 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2772 KB Output is correct
8 Correct 2 ms 2676 KB Output is correct
9 Correct 5 ms 3128 KB Output is correct
10 Correct 1 ms 2644 KB Output is correct
11 Correct 2 ms 2772 KB Output is correct
12 Correct 6 ms 3540 KB Output is correct
13 Correct 6 ms 3540 KB Output is correct
14 Correct 2 ms 2644 KB Output is correct
15 Correct 3 ms 2772 KB Output is correct
16 Correct 619 ms 72716 KB Output is correct
17 Correct 63 ms 13680 KB Output is correct
18 Correct 83 ms 15240 KB Output is correct
19 Correct 688 ms 75444 KB Output is correct
20 Correct 476 ms 66152 KB Output is correct
21 Correct 36 ms 7684 KB Output is correct
22 Correct 429 ms 46468 KB Output is correct