Submission #752454

# Submission time Handle Problem Language Result Execution time Memory
752454 2023-06-03T03:39:19 Z jamielim Computer Network (BOI14_network) C++14
100 / 100
97 ms 4488 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(ans[i]);
}

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]);
      |             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 74 ms 4296 KB Output is correct
2 Correct 69 ms 4372 KB Output is correct
3 Correct 62 ms 4356 KB Output is correct
4 Correct 62 ms 4364 KB Output is correct
5 Correct 65 ms 4364 KB Output is correct
6 Correct 65 ms 4364 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 340 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 4172 KB Output is correct
2 Correct 17 ms 2392 KB Output is correct
3 Correct 88 ms 4312 KB Output is correct
4 Correct 60 ms 4276 KB Output is correct
5 Correct 68 ms 4316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 4160 KB Output is correct
2 Correct 18 ms 2452 KB Output is correct
3 Correct 70 ms 4376 KB Output is correct
4 Correct 59 ms 4356 KB Output is correct
5 Correct 72 ms 4488 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 74 ms 4172 KB Output is correct
2 Correct 17 ms 2352 KB Output is correct
3 Correct 70 ms 4424 KB Output is correct
4 Correct 59 ms 4172 KB Output is correct
5 Correct 97 ms 4196 KB Output is correct