Submission #752464

#TimeUsernameProblemLanguageResultExecution timeMemory
752464salmonComputer Network (BOI14_network)C++14
100 / 100
83 ms4308 KiB
#include "network.h" #include <bits/stdc++.h> using namespace std; void findRoute (int N, int a, int b){ int dist[N + 5]; vector<pair<int,int>> v; for(int i = 1; i <= N; i++){ if(i != a && i != b){ dist[i] = ping(i,b) + 1; v.push_back(make_pair(dist[i],i)); } else{ dist[i] = 10000; } } int d = ping(a,b) + 1; sort(v.begin(),v.end(),greater<pair<int,int>>()); for(int i = 0; i < N - 2; i++){ if(v[i].first >= d){ continue; } if(ping(v[i].second,a) + 1 == 1){ a = v[i].second; d--; travelTo(a); } } travelTo(b); }

Compilation message (stderr)

grader.c: In function 'int main()':
grader.c:48:11: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |     scanf ("%d%d%d%d", &N, &a, &b, &M);
      |     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
grader.c:51:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   51 |             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...