Submission #752467

# Submission time Handle Problem Language Result Execution time Memory
752467 2023-06-03T04:21:48 Z 125259 Computer Network (BOI14_network) C++17
25 / 100
87 ms 4216 KB
#include "network.h"
#include <bits/stdc++.h>
using namespace std;

vector<int>v;
bool visited[1005];

void f(int n, int s, int e, int dist){
	if(dist==0) {v.push_back(e); visited[e]=1; return;}
	for(int i=1; i<=n; i++){
		if(i==s or i==e or visited[i]) continue;
		int d1=ping(s,i), d2=ping(i,e);
		if(d1 + d2 == dist-1){
			f(n,s,i,d1); f(n,i,e,d2);
			break;
		}
	}
}

void findRoute (int n, int a, int b){
	
    int dist = ping(a, b);
    f(n,a,b,dist);
    for(int i=0; i<v.size(); i++) travelTo(v[i]);
}

Compilation message

network.cpp: In function 'void findRoute(int, int, int)':
network.cpp:24:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for(int i=0; i<v.size(); i++) travelTo(v[i]);
      |                  ~^~~~~~~~~
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 Incorrect 87 ms 4172 KB Too many calls to ping
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 79 ms 4196 KB Output is correct
2 Correct 20 ms 2296 KB Output is correct
3 Correct 84 ms 4216 KB Output is correct
4 Correct 78 ms 4136 KB Output is correct
5 Correct 87 ms 4212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 82 ms 4164 KB Too many calls to ping
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 85 ms 4164 KB Too many calls to ping
2 Halted 0 ms 0 KB -