Submission #855854

# Submission time Handle Problem Language Result Execution time Memory
855854 2023-10-02T03:35:29 Z Hard_slipper Computer Network (BOI14_network) C++14
0 / 100
71 ms 28052 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 final_dist = dist-1;
    while(cur_dist < dist)
    {
        for(int i = 0; i < path[cur_dist][final_dist].size(); i++)
        {
            int cur_node = path[cur_dist][final_dist][i];
            int dem_dist = ping(cur_node, b)+1;
            if(dem_dist == final_dist)
            {
                //cout << cur_node << '\n';
                travelTo(cur_node);
                break;
            }
        }
        final_dist--;
        cur_dist++;
    }
    travelTo(b);
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:28:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         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]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 71 ms 28044 KB Too many calls to ping
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 28036 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 27988 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 28052 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -