답안 #206681

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
206681 2020-03-04T12:51:54 Z PeppaPig 컴퓨터 네트워크 (BOI14_network) C++14
0 / 100
134 ms 4604 KB
#include "network.h"
#include <bits/stdc++.h>

#define pii pair<int, int>
#define x first
#define y second

using namespace std;

const int N = 1e3+5;

map<pii, int> mp;

int get_dist(int a, int b) {
    if(a == b) return 0;
    else if(mp.count(pii(a, b))) return mp[pii(a, b)];
    else return mp[pii(a, b)] = mp[pii(b, a)] = ping(a, b) + 1;
}

int len;
vector<int> dist[N];

void findRoute (int n, int a, int b) {
    for(int i = 1; i <= n; i++) if(i != a) {
        int now = get_dist(a, i);
        dist[now].emplace_back(i);
        if(i == b) len = now;
    }
    int pre = a;
    for(int i = 1; i < len; i++) for(int x : dist[i])
        if(get_dist(pre, x) == 1) {
            travelTo(x);
            pre = x;
            break;
        }
    travelTo(b);
}

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 134 ms 4604 KB Output is correct
2 Incorrect 128 ms 4472 KB Travelling to nonadjacent computer
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 117 ms 4472 KB Output is correct
2 Incorrect 32 ms 2424 KB Travelling to nonadjacent computer
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 121 ms 4472 KB Output is correct
2 Incorrect 32 ms 2424 KB Travelling to nonadjacent computer
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 119 ms 4552 KB Output is correct
2 Incorrect 33 ms 2424 KB Travelling to nonadjacent computer
3 Halted 0 ms 0 KB -