Submission #1000713

#TimeUsernameProblemLanguageResultExecution timeMemory
1000713Nomio경주 (Race) (IOI11_race)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
int best_path(int n, int k, vector<pair<int, int>> H, vector<int> L) {
//	vector<int> adj[n + 1];
//	for(int i = 0; i < n - 1; i++) {
//		int a, b;
//		a = H[i][0];
//		b = H[i][1];
//		a++;
//		b++;
//		adj[a].push_back(b);
//		adj[b].push_back(a);
//	}
	int S[n + 1] {};
	for(int i = 0; i < n - 1; i++) {
		S[i + 2] = S[i + 1] + L[i];
	}
	int mn = n;
	for(int i = 2; i <= n; i++) {
		for(int j = 1; j <= i - 1; j++) {
			if(S[i] - S[j] == k) {
				mn = min(mn, i - j);
			}
		}
	}
	if(mn == n) mn = -1; 
	return mn;
}
//int main() {
//	cout << best_path(3, 3, {{0, 1}, {1, 2}}, {1, 1}) << '\n';
//	return 0;
//}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccOVx5Ni.o: in function `main':
grader.cpp:(.text.startup+0x28): undefined reference to `best_path(int, int, int (*) [2], int*)'
collect2: error: ld returned 1 exit status