답안 #42634

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
42634 2018-03-01T15:20:39 Z XmtosX 컴퓨터 네트워크 (BOI14_network) C++14
100 / 100
146 ms 58644 KB
#include <bits/stdc++.h>
using namespace std;
void findRoute(int N,int a,int b);
int ping(int i,int j);
void travelTo(int k);
int n,dis[1004];
vector <int> v;
void findRoute(int N,int a,int b)
{
    n=N;
    for (int i=1;i<=n;i++)
    {
        if (i==b)
            continue;
        dis[i]=ping(i,b);
    }
    int x=dis[a],last=a;
    while (x)
    {
        for (int i=1;i<=n;i++)
        {
            if (dis[i]==x-1&&ping(i,last)==0)
            {
                last=i;
                x--;
                v.push_back(i);
                break;
            }
        }
    }
    for (int i=0;i<v.size();i++)
    {
        travelTo(v[i]);
    }
    travelTo(b);
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:31:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0;i<v.size();i++)
                   ^
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]);
                                         ^
# 결과 실행 시간 메모리 Grader output
1 Correct 146 ms 8056 KB Output is correct
2 Correct 137 ms 11296 KB Output is correct
3 Correct 102 ms 14200 KB Output is correct
4 Correct 101 ms 16836 KB Output is correct
5 Correct 99 ms 19388 KB Output is correct
6 Correct 112 ms 21872 KB Output is correct
7 Correct 1 ms 21872 KB Output is correct
8 Correct 1 ms 21872 KB Output is correct
9 Correct 1 ms 21872 KB Output is correct
10 Correct 2 ms 21872 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 104 ms 24488 KB Output is correct
2 Correct 26 ms 24488 KB Output is correct
3 Correct 116 ms 28604 KB Output is correct
4 Correct 92 ms 30576 KB Output is correct
5 Correct 131 ms 34180 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 111 ms 36624 KB Output is correct
2 Correct 29 ms 36624 KB Output is correct
3 Correct 121 ms 40832 KB Output is correct
4 Correct 92 ms 42720 KB Output is correct
5 Correct 120 ms 46520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 105 ms 48832 KB Output is correct
2 Correct 27 ms 48832 KB Output is correct
3 Correct 133 ms 53112 KB Output is correct
4 Correct 102 ms 55076 KB Output is correct
5 Correct 130 ms 58644 KB Output is correct