답안 #36575

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
36575 2017-12-11T02:39:48 Z minkank 컴퓨터 네트워크 (BOI14_network) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> ii;
#define st first
#define nd second

void findRoute(int N, int S, int T) {
	vector<ii> path;
	vector<int> res;
	path.push_back(ii(0, S));
	for(int i = 1; i <= N; ++i) if(i != S) path.push_back(ii(ping(S, i), i));
	sort(path.begin(), path.end());
	int last = -1;
	for(int i = path.size() - 1; i >= 0; --i) {
		if(path[i].nd == T) {
			last = i;
			continue;
		}
		if(path[i].nd == S) break;
		if(last != -1) {
			int val = ping(path[i].st, last);
			if(val == -1) continue;
			if(val + path[i].nd + 1 == path[last].st) last = i, res.push_back(path[i].nd);
		}
	}
	for(int i = res.size() - 1; i >= 0; --i) travelTo(res[i]); 
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:12:68: error: 'ping' was not declared in this scope
  for(int i = 1; i <= N; ++i) if(i != S) path.push_back(ii(ping(S, i), i));
                                                                    ^
network.cpp:22:35: error: 'ping' was not declared in this scope
    int val = ping(path[i].st, last);
                                   ^
network.cpp:27:58: error: 'travelTo' was not declared in this scope
  for(int i = res.size() - 1; i >= 0; --i) travelTo(res[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]);
                                         ^