제출 #1314786

#제출 시각아이디문제언어결과실행 시간메모리
1314786mantaggezComputer Network (BOI14_network)C++20
25 / 100
53 ms4512 KiB
#include "network.h" #include <bits/stdc++.h> #define pii pair<int, int> using namespace std; void findRoute (int N, int a, int b) { /* * Obviously, this is not a good solution. * Replace it with your own code. */ const int INF = 1e9; vector<int> adj[N + 1], vs(N + 1, 0), pa(N + 1, -1), dist(N + 1, INF); for(int i=1;i<=N;i++) { for(int j=1;j<=N;j++) { if(i == j) continue; if(ping(i, j) == 0) adj[i].push_back(j); } } dist[a] = 0; queue<int> q; q.push(a); while(!q.empty()) { int u = q.front(); q.pop(); if(vs[u]) continue; vs[u] = 1; for(auto v : adj[u]) { if(dist[v] > dist[u] + 1) { pa[v] = u; dist[v] = dist[u] + 1; q.push(v); } } } int cur = b; vector<int> ans; while(pa[cur] != -1) { int prev = pa[cur]; ans.push_back(cur); cur = prev; } reverse(ans.begin(), ans.end()); for(auto x : ans) travelTo(x); }

컴파일 시 표준 에러 (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...