답안 #151883

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151883 2019-09-05T09:33:15 Z Ruxandra985 컴퓨터 네트워크 (BOI14_network) C++14
75 / 100
115 ms 7388 KB
#include <cstdio>
#include "network.h"
 
void findRoute (int n,int a,int b){
    int da[n+1],db[n+1];
    int i,curr,x,y,xn,yn,nxt;
    for (i=1;i<=n;i++){
        if (i!=a)
            da[i] = ping (a,i);
        if (i!=b)
            db[i] = ping (b,i);
    }
    curr = a;
    x = -1;
    y = da[b];
    while (curr!=b){
 		int more = 0;
        for (i=1;i<=n;i++){
            if (i!=curr){
                if (i!=b){
                    xn = da[i];
                    yn = db[i];
                }
                else {
                    xn = da[i];
                    yn = -1;
                }
                if (x+1 == xn && y-1 == yn){
                  	if (!more)
                    	nxt = i;
                  	else {
                      	if (ping(curr,nxt)==0)
                          break;
                      	else nxt = i;
                    }
    				more = 1;
              
                }
            }
        }
 
        travelTo(nxt);
        curr = nxt;
        x++;
        y--;
    }
 
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:16:16: warning: 'nxt' may be used uninitialized in this function [-Wmaybe-uninitialized]
     while (curr!=b){
            ~~~~^~~
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 115 ms 4284 KB Output is correct
2 Correct 111 ms 7388 KB Output is correct
3 Correct 101 ms 7004 KB Output is correct
4 Correct 101 ms 7036 KB Output is correct
5 Correct 100 ms 6648 KB Output is correct
6 Correct 101 ms 6672 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 105 ms 4344 KB Output is correct
2 Correct 26 ms 2328 KB Output is correct
3 Correct 113 ms 4244 KB Output is correct
4 Correct 92 ms 4216 KB Output is correct
5 Correct 113 ms 4216 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 4260 KB Output is correct
2 Correct 26 ms 2268 KB Output is correct
3 Correct 113 ms 4216 KB Output is correct
4 Correct 92 ms 4216 KB Output is correct
5 Correct 113 ms 4288 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 104 ms 4316 KB Too many calls to ping
2 Halted 0 ms 0 KB -