답안 #855895

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
855895 2023-10-02T07:08:35 Z Hard_slipper 컴퓨터 네트워크 (BOI14_network) C++14
50 / 100
84 ms 31780 KB
#include "network.h"
//#include "grader.cpp"
#include<bits/stdc++.h>
using namespace std;

vector<int> path[1005][1005] = {};
int vis[1005] = {};
void findRoute (int N, int a, int b)
{
    int dist = ping(a, b)+1;

    for(int i =1; i <= N; i++)
    {
        if(i == a || i == b) continue;
        int cur_dist = ping(a, i)+1;
        int final_dist = ping(i, b)+1;
        //cout << cur_dist << ' ' << final_dist << '\n';
        if(cur_dist+final_dist == dist)
        {
            path[cur_dist][final_dist].push_back(i);
        }
    }
    path[dist][0].push_back(b);
    int cur_dist = 1;
    int cur_node = a;
    int final_dist = dist-1;
    while(cur_dist <= dist)
    {
        for(int i = 0; i < path[cur_dist][final_dist].size(); i++)
        {
            int node = path[cur_dist][final_dist][i];

            if(ping(cur_node, node) == 0)
            {
                cur_node = node;
                travelTo(node);
                break;
            }
        }
        final_dist--;
        cur_dist++;
    }
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:29:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |         for(int i = 0; i < path[cur_dist][final_dist].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 77 ms 31060 KB Too many calls to ping
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 74 ms 30300 KB Output is correct
2 Correct 22 ms 27740 KB Output is correct
3 Correct 82 ms 31488 KB Output is correct
4 Correct 68 ms 29952 KB Output is correct
5 Correct 77 ms 31568 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 30320 KB Output is correct
2 Correct 22 ms 27736 KB Output is correct
3 Correct 84 ms 31700 KB Output is correct
4 Correct 68 ms 30032 KB Output is correct
5 Correct 76 ms 31780 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 74 ms 30288 KB Too many calls to ping
2 Halted 0 ms 0 KB -