Submission #31940

#TimeUsernameProblemLanguageResultExecution timeMemory
31940chonkaComputer Network (BOI14_network)C++98
100 / 100
169 ms6056 KiB
#include "network.h" #include<iostream> #include<stdio.h> #include<vector> #include<algorithm> #include<queue> using namespace std ; #define MAXN 1007 int n ; int st[ MAXN ] ; int en[ MAXN ] ; bool used[ MAXN ] ; vector < int > v[ 2 * MAXN ]; bool cmp ( int x , int y ) { return ( st[ x ] < st[ y ] ) ; } void findRoute ( int N, int a, int b ) { int i ; n = N ; for ( i = 1 ; i <= n ; i ++ ) { if ( i == a ) { continue ; } st[ i ] = ping ( a , i ) ; v[ st[ i ] ].push_back ( i ) ; } int dist = ping ( a , b ) ; int x = b ; vector < int > ret ; while ( st[ x ] > 0 ) { int sz = v[ st[ x ] - 1 ].size ( ) ; for ( i = 0 ; i < sz ; i ++ ) { if ( ping ( x , v[ st[ x ] - 1 ][ i ] ) == 0 ) { x = v[ st[ x ] - 1 ][ i ] ; ret.push_back ( x ) ; break ; } } } int sz = ret.size ( ) ; for ( i = sz - 1 ; i >= 0 ; i -- ) { travelTo ( ret[ i ] ) ; } travelTo ( b ) ; }

Compilation message (stderr)

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:32:9: warning: unused variable 'dist' [-Wunused-variable]
     int dist = ping ( a , b ) ;
         ^
grader.c: In function 'int main()':
grader.c:48:39: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d%d%d%d", &N, &a, &b, &M);
                                       ^
grader.c:51:41: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &distance[u][v]);
                                         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...