제출 #1348488

#제출 시각아이디문제언어결과실행 시간메모리
1348488bananacookie컴퓨터 네트워크 (BOI14_network)C++20
25 / 100
38 ms4484 KiB
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
#include "network.h"

const int NN=1000+2;
vector<int> adj[NN];
int past[NN],dist[NN];

void bfs(int s){
    queue<int> q; 
    dist[s]=0; past[s]=-1; q.push(s);

    while(!q.empty())
    {
        int u=q.front(); q.pop();

        for(int v:adj[u]){
            if(dist[v]==-1){
                dist[v]=dist[u]+1;
                past[v]=u;
                q.push(v);
            }
        }
    }
}

void findRoute (int N, int a, int b)
{
    for(int i=1;i<=N-1;i++){
        for(int j=i+1;j<=N;j++){
            if(!ping(i,j)){
                adj[i].push_back(j);
                adj[j].push_back(i);
            }
        }
    }

    for(int i=1;i<=N;i++) dist[i]=-1;
    bfs(a);

    vector<int> path;
    int cur=b;
    while(cur!=a){
        path.push_back(cur);

        cur=past[cur];
    }

    reverse(path.begin(),path.end());

    for(int x:path){
        travelTo(x);
    }

    //for(int i=1;i<=2;i++) travelTo(i);
}

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