답안 #823898

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
823898 2023-08-13T09:54:14 Z irmuun 컴퓨터 네트워크 (BOI14_network) C++17
0 / 100
62 ms 8116 KB
#include<bits/stdc++.h>
#include "network.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

void findRoute(int n,int a,int b){
    int p[n+1][n+1];
    vector<int>adj[n+1];
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            p[i][j]=ping(i,j);
            if(p[i][j]==0){
                adj[i].pb(j);
                adj[j].pb(i);
            }
        }
    }
    queue<ll>q;
    int par[n+1];
    fill(par,par+n+1,-1);
    par[a]=0;
    q.push(a);
    while(!q.empty()){
        int x=q.front();
        q.pop();
        for(auto y:adj[x]){
            if(par[y]==-1){
                par[y]=x;
                q.push(y);
            }
        }
    }
    vector<int>v;
    while(b!=a){
        v.pb(b);
        b=par[b];
    }
    reverse(all(v));
    for(int i=0;i<v.size();i++){
        travelTo(v[i]);
    }
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:46:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |     for(int i=0;i<v.size();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]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 62 ms 8092 KB ping called with invalid arguments
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 61 ms 8056 KB ping called with invalid arguments
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 61 ms 8116 KB ping called with invalid arguments
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 62 ms 8108 KB ping called with invalid arguments
2 Halted 0 ms 0 KB -