Submission #31925

# Submission time Handle Problem Language Result Execution time Memory
31925 2017-09-15T21:13:11 Z chonka Computer Network (BOI14_network) C++
25 / 100
129 ms 6060 KB
#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

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 time Memory Grader output
1 Correct 123 ms 6060 KB Output is correct
2 Correct 126 ms 6060 KB Output is correct
3 Correct 129 ms 6060 KB Output is correct
4 Correct 106 ms 6060 KB Output is correct
5 Correct 99 ms 6060 KB Output is correct
6 Correct 106 ms 6060 KB Output is correct
7 Correct 0 ms 6060 KB Output is correct
8 Correct 0 ms 6060 KB Output is correct
9 Correct 0 ms 6060 KB Output is correct
10 Correct 0 ms 6060 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 106 ms 6060 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 6060 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 113 ms 6060 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -