# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
308570 | 2020-10-01T14:37:01 Z | kylych03 | Crocodile's Underground City (IOI11_crocodile) | C++14 | 2 ms | 2688 KB |
#include "crocodile.h" #include <bits/stdc++.h> //#include "grader.cpp" using namespace std; vector <pair <int, int > > g[100002]; int inf =1e9+7; pair <int, int> a[100001]; int travel_plan(int N, int M, int R[][2], int L[], int K, int P[]) { for(int i = 0; i <= N; i++){ a[i].first=inf; a[i].second=inf; } set <pair <int, int> > st; set <pair <int, int> > ::iterator it; for(int i = 0 ; i < M ;i++){ g[R[i][0]].push_back(make_pair (R[i][1], L[i]) ); g[R[i][1]].push_back( make_pair (R[i][0], L[i])); } for(int i = 0; i < K; i++){ st.insert(make_pair(0,P[i])); a[P[i]].first=0; a[P[i]].second=0; } while(!st.empty()){ it = st.begin(); int len = it->first; int v = it -> second; st.erase(it); //if( len > a[v].second) //continue; for(int i= 0 ; i< g[v].size() ; i++ ){ int to = g[v][i].first; int dis = g[v][i].second; if(a[to].second > len + dis){ /*if(a[to].second!=inf){ pair <int, int> p1; p1.first = a[to].second; p1.second = to; st.erase(p1); }*/ a[to].second = len + dis; if(a[to].first > a[to].second) swap(a[to].first, a[to].second); if(a[to].second < inf) st.insert(make_pair( a[to].second, to)); } } } return a[0].second; } /* 5 4 3 0 1 2 0 2 3 3 2 1 2 4 4 1 3 4 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Incorrect | 2 ms | 2688 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Incorrect | 2 ms | 2688 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 2688 KB | Output is correct |
2 | Correct | 2 ms | 2688 KB | Output is correct |
3 | Incorrect | 2 ms | 2688 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |