Submission #741683

#TimeUsernameProblemLanguageResultExecution timeMemory
741683TheOpChickenComputer Network (BOI14_network)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include "network.h" using namespace std; void findRoute(int n, int a, int b){ vector<vector<int> > dist(n+5, vector<int>()); vector<int> length(n+5); dist[0].push_back(a); for (int i = 1; i <= n; i++){ if (i == a) continue; int len = ping(a, i); dist[len].push_back(a); length[i] = len; } int cur_node = b; vector<int> ans; for (int i = length[b]; i >= 1; i--){ ans.push_back(cur_node); for (int node: dist[i-1]){ int len = ping(cur_node, node); if (len == 1){ cur = node; break; } } } reverse(ans.begin(), ans.end()); for (int i = 0; i < ans.size(); i++) travelTo(ans[i]); return; }

Compilation message (stderr)

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:24:5: error: 'cur' was not declared in this scope
   24 |     cur = node;
      |     ^~~
network.cpp:30:2: error: 'reverse' was not declared in this scope
   30 |  reverse(ans.begin(), ans.end());
      |  ^~~~~~~
network.cpp:31:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for (int i = 0; i < ans.size(); i++) travelTo(ans[i]);
      |                  ~~^~~~~~~~~~~~
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]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~