Submission #969754

# Submission time Handle Problem Language Result Execution time Memory
969754 2024-04-25T14:32:33 Z zh_h Cyberland (APIO23_cyberland) C++17
0 / 100
23 ms 7744 KB
#include <bits/stdc++.h>
#define pb push_back
using namespace std;

const int n = 1e5+5;

vector<vector<pair<int, int>>> adj(n);
vector<bool> visited(n, false);

double dfs(int x, int h, int s){
	if(x == h){return s;}
	for(auto i : adj[x]){
		if(!visited[i.first]){
			visited[i.first] = true;
			return dfs(i.first, h, s+i.second);
		}
	}
}

double solve(int N, int M, int K, int H, vector<int> x, vector<int> y, vector<int> c, vector<int> r){

	visited[0] = true;

	for(int i =0; i < M; i ++){
	 	adj[x[i]].pb({y[i], c[i]});
	 	adj[y[i]].pb({x[i], c[i]});
	}

	return dfs(0, H, 0);
}

Compilation message

cyberland.cpp: In function 'double dfs(int, int, int)':
cyberland.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
   18 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 5212 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 5464 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 5212 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 23 ms 7744 KB Double -6.15963e+08 violates the range [-1, 1e+18]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 5388 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 5468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 5212 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 5208 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -