# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
31940 | 2017-09-16T13:11:51 Z | chonka | Computer Network (BOI14_network) | C++ | 169 ms | 6056 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 163 ms | 6056 KB | Output is correct |
2 | Correct | 126 ms | 6056 KB | Output is correct |
3 | Correct | 123 ms | 6056 KB | Output is correct |
4 | Correct | 136 ms | 6056 KB | Output is correct |
5 | Correct | 129 ms | 6056 KB | Output is correct |
6 | Correct | 106 ms | 6056 KB | Output is correct |
7 | Correct | 0 ms | 6056 KB | Output is correct |
8 | Correct | 0 ms | 6056 KB | Output is correct |
9 | Correct | 0 ms | 6056 KB | Output is correct |
10 | Correct | 0 ms | 6056 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 146 ms | 6056 KB | Output is correct |
2 | Correct | 23 ms | 6056 KB | Output is correct |
3 | Correct | 129 ms | 6056 KB | Output is correct |
4 | Correct | 133 ms | 6056 KB | Output is correct |
5 | Correct | 169 ms | 6056 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 126 ms | 6056 KB | Output is correct |
2 | Correct | 33 ms | 6056 KB | Output is correct |
3 | Correct | 113 ms | 6056 KB | Output is correct |
4 | Correct | 113 ms | 6056 KB | Output is correct |
5 | Correct | 123 ms | 6056 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 133 ms | 6056 KB | Output is correct |
2 | Correct | 19 ms | 6056 KB | Output is correct |
3 | Correct | 146 ms | 6056 KB | Output is correct |
4 | Correct | 126 ms | 6056 KB | Output is correct |
5 | Correct | 153 ms | 6056 KB | Output is correct |