# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31940 | chonka | Computer Network (BOI14_network) | C++98 | 169 ms | 6056 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |