# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
394579 | 2021-04-27T01:02:04 Z | definitelynotmee | Crocodile's Underground City (IOI11_crocodile) | C++ | 3 ms | 2764 KB |
#include <bits/stdc++.h> #include "crocodile.h" #define mp make_pair #define mt make_tuple #define ff first #define ss second using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll INFL = (1LL<<62)-1; const int INF = (1<<30)-1; const int MAXN = 100001; vector<pii> grafo[MAXN]; int travel_plan(int n, int m, int r[][2], int l[], int k, int p[]){ for(int i = 0; i < m; i++){ grafo[r[i][0]].push_back({r[i][1], l[i]}); grafo[r[i][1]].push_back({r[i][0], l[i]}); } set<pii> s; vector<int> dist(n,INF); vector<set<int>> possd (n); for(int i = 0; i < n; i++) s.insert({INF,i}); for(int i = 0; i < k; i++) s.erase({INF,p[i]}),s.insert({0,p[i]}), dist[p[i]] = 0; while(!s.empty()){ int cur = s.begin()->second; s.erase(s.begin()); if(dist[cur] >= INF) break; for(int i = 0; i < grafo[cur].size(); i++){ int viz = grafo[cur][i].ff; int vizp = grafo[cur][i].ss; if((ll)vizp + dist[cur] >= INF) continue; possd[viz].insert(vizp + dist[cur]); if(possd[viz].size()>1 && dist[viz] > *(++possd[viz].begin())){ s.erase({dist[viz],viz}); dist[viz] = *(++possd[viz].begin()); s.insert({dist[viz],viz}); } } } return dist[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2636 KB | Output is correct |
3 | Correct | 2 ms | 2636 KB | Output is correct |
4 | Incorrect | 3 ms | 2764 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2636 KB | Output is correct |
3 | Correct | 2 ms | 2636 KB | Output is correct |
4 | Incorrect | 3 ms | 2764 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2636 KB | Output is correct |
2 | Correct | 2 ms | 2636 KB | Output is correct |
3 | Correct | 2 ms | 2636 KB | Output is correct |
4 | Incorrect | 3 ms | 2764 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |