# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31925 | chonka | Computer Network (BOI14_network) | C++98 | 129 ms | 6060 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>
using namespace std ;
#define MAXN 1007
int n ;
int st[ MAXN ] ;
int en[ 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 || i == b ) { continue ; }
st[ i ] = ping ( a , i ) ;
en[ i ] = ping ( i , b ) ;
v[ st[ i ] + en[ i ] ].push_back ( i ) ;
}
int dist = ping ( a , b ) ;
dist -- ;
sort ( v[ dist ].begin ( ) , v[ dist ].end ( ) , cmp ) ;
int sz = v[ dist ].size ( ) ;
int lst = -1 ;
for ( i = 0 ; i < sz ; i ++ ) {
if ( st[ v[ dist ][ i ] ] == lst + 1 ) {
travelTo ( v[ dist ][ i ] ) ;
lst = st[ v[ dist ][ 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... |