Submission #855849

# Submission time Handle Problem Language Result Execution time Memory
855849 2023-10-02T03:16:56 Z Hard_slipper Computer Network (BOI14_network) C++14
0 / 100
70 ms 28244 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];
            if(cur_node == b)
            {
                travelTo(cur_node);
                break;
            }
            //cout << cur_node << ' ';

            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++;
    }
}

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 67 ms 27988 KB Too many calls to ping
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 28060 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 68 ms 27960 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 28244 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -