답안 #752364

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
752364 2023-06-03T01:19:40 Z jamielim 컴퓨터 네트워크 (BOI14_network) C++14
25 / 100
100 ms 7948 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);
    for(int i=1;i<=N;i++){
		if(i==a||i==b)continue;
		int x=ping(i,a);
		dista[x].pb(i);
	}
	int cur=a;
	if(d>(N-2)/2){
		for(int i=0;i<d;i++){
			for(int j:dista[i]){
				if(ping(j,b)+i+1==d){
					cur=j;
					travelTo(j);
					break;
				}
			}
		}
		travelTo(b);
	}else{
		for(int i=0;i<d;i++){
			for(int j:dista[i]){
				if(i==0||ping(cur,j)==0){
					if(ping(j,b)+i+1==d){
						cur=j;
						travelTo(j);
						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]
   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 Correct 89 ms 7948 KB Output is correct
2 Correct 100 ms 7364 KB Output is correct
3 Correct 87 ms 7000 KB Output is correct
4 Correct 88 ms 6968 KB Output is correct
5 Correct 82 ms 6640 KB Output is correct
6 Correct 79 ms 6700 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 78 ms 6640 KB Output is correct
2 Correct 34 ms 2800 KB Output is correct
3 Incorrect 88 ms 7864 KB Travelling to nonadjacent computer
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 6596 KB Output is correct
2 Correct 22 ms 2756 KB Output is correct
3 Incorrect 82 ms 7840 KB Travelling to nonadjacent computer
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 74 ms 6620 KB Output is correct
2 Correct 20 ms 2832 KB Output is correct
3 Incorrect 79 ms 7824 KB Travelling to nonadjacent computer
4 Halted 0 ms 0 KB -