Submission #823977

# Submission time Handle Problem Language Result Execution time Memory
823977 2023-08-13T10:55:05 Z irmuun Computer Network (BOI14_network) C++17
100 / 100
73 ms 7896 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){
    vector<int>v[n+1];
    int hi;
    for(int i=1;i<=n;i++){
        if(i==b) continue;
        int x=ping(i,b);
        v[x].pb(i);
        if(i==a) hi=x;
    }
    while(hi){
        for(auto i:v[hi-1]){
            if(ping(a,i)==0){
                travelTo(i);
                hi--;
                a=i;
                break;
            }
        }
    }
    travelTo(b);
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:15:9: warning: 'hi' may be used uninitialized in this function [-Wmaybe-uninitialized]
   15 |     int hi;
      |         ^~
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 62 ms 4284 KB Output is correct
2 Correct 63 ms 4168 KB Output is correct
3 Correct 63 ms 4172 KB Output is correct
4 Correct 63 ms 4260 KB Output is correct
5 Correct 67 ms 4220 KB Output is correct
6 Correct 68 ms 4176 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 4200 KB Output is correct
2 Correct 19 ms 2752 KB Output is correct
3 Correct 65 ms 7728 KB Output is correct
4 Correct 72 ms 6124 KB Output is correct
5 Correct 64 ms 7880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 4164 KB Output is correct
2 Correct 20 ms 2828 KB Output is correct
3 Correct 65 ms 7744 KB Output is correct
4 Correct 71 ms 6132 KB Output is correct
5 Correct 66 ms 7896 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 73 ms 4264 KB Output is correct
2 Correct 19 ms 2824 KB Output is correct
3 Correct 69 ms 7828 KB Output is correct
4 Correct 72 ms 6144 KB Output is correct
5 Correct 63 ms 7860 KB Output is correct