답안 #752453

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
752453 2023-06-03T03:38:33 Z jamielim 컴퓨터 네트워크 (BOI14_network) C++14
0 / 100
98 ms 4472 KB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> ii;
const int INF=1012345678;

map<int,vector<int> > dista;

void findRoute (int N, int a, int b){
	int d=ping(a,b)+1;
    for(int i=1;i<=N;i++){
		if(i==a||i==b)continue;
		int x=ping(i,a)+1;
		dista[x].pb(i);
	}
	int ans[d+1];
	ans[d]=b;
	int cur=b;
	for(int i=d-1;i>=1;i--){
		for(int j:dista[i]){
			int y=ping(j,cur);
			if(y==0){
				cur=j;
				ans[i]=j;
				break;
			}
		}
	}
	for(int i=1;i<=d;i++)travelTo(i);
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:22:6: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
   22 |  int ans[d+1];
      |      ^~~
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]
   48 |     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]
   51 |             scanf("%d", &distance[u][v]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 98 ms 4472 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 86 ms 4340 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 90 ms 4312 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 94 ms 4280 KB Travelling to nonadjacent computer
2 Halted 0 ms 0 KB -