답안 #165064

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
165064 2019-11-25T03:23:55 Z Lawliet 컴퓨터 네트워크 (BOI14_network) C++14
100 / 100
126 ms 8144 KB
#include <bits/stdc++.h>
#include "network.h"

using namespace std;

const int MAXN = 1010;

vector< int > ord[MAXN];

void findRoute (int N, int S, int T)
{
	int minDist = ping( S , T );

	ord[ minDist ].push_back( S );

	for(int i = 1 ; i <= N ; i++)
	{
		if( i == S || i == T ) continue;

		int cur = ping( i , T );
		ord[ cur ].push_back( i );
	}

	int curNode = S;
    int curDist = minDist;

    while( curDist > 0 )
    {
    	curDist--;

    	for(int j = 0 ; j < ord[ curDist ].size() ; j++)
    	{
    		int viz = ord[ curDist ][ j ];

    		if( ping( curNode , viz ) == 0 )
    		{
    			curNode = viz;
    			break;
    		}
    	}

    	travelTo( curNode );
    }

    travelTo( T );
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:31:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(int j = 0 ; j < ord[ curDist ].size() ; j++)
                      ~~^~~~~~~~~~~~~~~~~~~~~~~
grader.c: In function 'int main()':
grader.c:48:11: 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:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &distance[u][v]);
             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 120 ms 8144 KB Output is correct
2 Correct 118 ms 7672 KB Output is correct
3 Correct 103 ms 7160 KB Output is correct
4 Correct 104 ms 7132 KB Output is correct
5 Correct 103 ms 6776 KB Output is correct
6 Correct 103 ms 6776 KB Output is correct
7 Correct 2 ms 380 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 2 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 111 ms 6884 KB Output is correct
2 Correct 29 ms 2908 KB Output is correct
3 Correct 119 ms 7944 KB Output is correct
4 Correct 93 ms 6236 KB Output is correct
5 Correct 126 ms 8120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 110 ms 6808 KB Output is correct
2 Correct 27 ms 2936 KB Output is correct
3 Correct 121 ms 7916 KB Output is correct
4 Correct 94 ms 6236 KB Output is correct
5 Correct 123 ms 8084 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 108 ms 7060 KB Output is correct
2 Correct 27 ms 2936 KB Output is correct
3 Correct 120 ms 7928 KB Output is correct
4 Correct 95 ms 6264 KB Output is correct
5 Correct 118 ms 8056 KB Output is correct