Submission #42603

#TimeUsernameProblemLanguageResultExecution timeMemory
42603HassoonyComputer Network (BOI14_network)C++14
100 / 100
162 ms58832 KiB
#include<bits/stdc++.h> #define S second #define F first using namespace std; #include "network.h" int l; vector<pair<int,int> >v; vector<int>ans; void findRoute(int n,int a,int b){ v.push_back({0,a}); for(int i=1;i<=n;i++){ if(i==a)continue; v.push_back({ping(a,i),i}); } sort(v.begin(),v.end()); while(v.back().S!=b)v.pop_back(); l=v.size()-1; ans.push_back(b); for(int i=v.size()-2;i>=0;i--){ int dis=ping(v[i].S,v[l].S); if(dis+v[i].F==v[l].F-1){ l=i; ans.push_back(v[i].S); } } reverse(ans.begin(),ans.end()); for(auto pp:ans)travelTo(pp); }

Compilation message (stderr)

grader.c: In function 'int main()':
grader.c:48:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d%d%d%d", &N, &a, &b, &M);
                                       ^
grader.c:51:41: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &distance[u][v]);
                                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...