# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42656 | 2018-03-01T21:03:05 Z | BlackFlag777 | Computer Network (BOI14_network) | C++14 | 126 ms | 6456 KB |
#include<bits/stdc++.h> using namespace std; void travelTo(int k); void findRoute(int N, int a, int b); int ping (int i, int j); void findRoute(int N, int a, int b) { vector<int>v[1003]; int par[1003],vis[1003]; map<pair<int,int>,bool>m; for(int i=1; i<=N; i++) { for(int j=1; j<=N; j++) { if(i!=j) { if(ping(i,j)==0&&!m[{i,j}]&&!m[{j,i}]) { v[i].push_back(j); v[j].push_back(i); m[{i,j}]=m[{j,i}]=1; } } } } queue<int>q; par[a]=-1; q.push(a); while(!q.empty()) { int p=q.front(); q.pop(); if(vis[p])continue; vis[p]=1; for(int i=0;i<v[p].size();i++) { if(!par[v[p][i]]&&par[v[p][i]]!=-1) { par[v[p][i]]=p; q.push(v[p][i]); } } } vector<int>ans; int temp=b; while(1) { ans.push_back(temp); temp=par[temp]; if(par[temp]==-1)break; } reverse(ans.begin(),ans.end()); for(int i=0;i<ans.size();i++) { travelTo(ans[i]); } return ; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 117 ms | 4216 KB | Too many calls to ping |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 125 ms | 6456 KB | Output is correct |
2 | Correct | 29 ms | 6456 KB | Output is correct |
3 | Correct | 120 ms | 6456 KB | Output is correct |
4 | Correct | 116 ms | 6456 KB | Output is correct |
5 | Correct | 126 ms | 6456 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 105 ms | 6456 KB | Too many calls to ping |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 110 ms | 6456 KB | Too many calls to ping |
2 | Halted | 0 ms | 0 KB | - |