Submission #855896

# Submission time Handle Problem Language Result Execution time Memory
855896 2023-10-02T07:17:59 Z Hard_slipper Computer Network (BOI14_network) C++14
100 / 100
80 ms 7896 KB
#include "network.h"
//#include "grader.cpp"
#include<bits/stdc++.h>
using namespace std;

vector<int> path[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';
        path[final_dist].push_back(i);
    }
    path[dist].push_back(b);
    int cur_dist = 0;
    int cur_node = a;
    int final_dist = dist-1;
    while(final_dist >= 0)
    {
        for(int i = 0; i < path[final_dist].size(); i++)
        {
            int node = path[final_dist][i];
            //cout << node << ' ' << final_dist << '\n';
            if(ping(cur_node, node) == 0)
            {
                cur_node = node;
                travelTo(node);
                break;
            }
        }
        final_dist--;
    }
    travelTo(b);
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:26:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for(int i = 0; i < path[final_dist].size(); i++)
      |                        ~~^~~~~~~~~~~~~~~~~~~~~~~~~
network.cpp:21:9: warning: unused variable 'cur_dist' [-Wunused-variable]
   21 |     int cur_dist = 0;
      |         ^~~~~~~~
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 Correct 64 ms 4180 KB Output is correct
2 Correct 68 ms 6988 KB Output is correct
3 Correct 65 ms 6480 KB Output is correct
4 Correct 64 ms 6484 KB Output is correct
5 Correct 67 ms 7024 KB Output is correct
6 Correct 64 ms 6708 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 4184 KB Output is correct
2 Correct 16 ms 2652 KB Output is correct
3 Correct 65 ms 4176 KB Output is correct
4 Correct 59 ms 4284 KB Output is correct
5 Correct 64 ms 4176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 63 ms 4208 KB Output is correct
2 Correct 16 ms 2648 KB Output is correct
3 Correct 80 ms 4176 KB Output is correct
4 Correct 58 ms 4180 KB Output is correct
5 Correct 64 ms 4180 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 64 ms 4176 KB Output is correct
2 Correct 16 ms 3164 KB Output is correct
3 Correct 66 ms 7764 KB Output is correct
4 Correct 60 ms 6228 KB Output is correct
5 Correct 65 ms 7896 KB Output is correct