답안 #154159

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
154159 2019-09-18T16:36:20 Z nicolaalexandra 컴퓨터 네트워크 (BOI14_network) C++14
100 / 100
124 ms 8056 KB
#include <iostream>
#include "network.h"
#include <cstring>
using namespace std;
int f[1010],dist_b[1010];

void findRoute (int n, int a, int b){
    memset (f,0,sizeof f);
    memset (dist_b,0,sizeof dist_b);
    for (int i=1;i<=n;i++){
        if (i == b)
            continue;
        dist_b[i] = ping (i,b);
    }
    int dist = dist_b[a];
    int nod = a;
    f[a] = 1;
    for (;;){
        dist--;
        if (dist == -1){
            travelTo(b);
            break;
        }
        for (int i=1;i<=n;i++){
            if (f[i])
                continue;
            if (dist_b[i] != dist)
                continue;
            if (ping(nod,i) == 0){
                travelTo(i);
                nod = i;
                f[nod] = 1;
                break;
            }}}}

Compilation message

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 121 ms 7928 KB Output is correct
2 Correct 118 ms 7704 KB Output is correct
3 Correct 103 ms 7032 KB Output is correct
4 Correct 103 ms 7160 KB Output is correct
5 Correct 104 ms 6832 KB Output is correct
6 Correct 102 ms 6744 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 1 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 108 ms 6708 KB Output is correct
2 Correct 27 ms 2808 KB Output is correct
3 Correct 124 ms 8056 KB Output is correct
4 Correct 93 ms 6188 KB Output is correct
5 Correct 119 ms 8036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 108 ms 6896 KB Output is correct
2 Correct 28 ms 2824 KB Output is correct
3 Correct 120 ms 7800 KB Output is correct
4 Correct 93 ms 6188 KB Output is correct
5 Correct 119 ms 7976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 108 ms 6768 KB Output is correct
2 Correct 27 ms 2936 KB Output is correct
3 Correct 121 ms 7976 KB Output is correct
4 Correct 94 ms 6276 KB Output is correct
5 Correct 120 ms 7980 KB Output is correct