답안 #283882

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
283882 2020-08-26T08:44:55 Z balbit Simurgh (IOI17_simurgh) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int, int>
#define f first
#define s second

#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)((x).size())
#define pb push_back

#ifdef BALBIT
#define bug(...) cerr<<"#"<<__LINE__<<" "<<#__VA_ARGS__<<": ", _do(__VA_ARGS__)
template <typename T> void _do(T && x) {cerr<<x<<endl;}
template <typename T, typename ...S> void _do(T && x, S&&...y) {cerr<<x<<", "; _do(y...);}
#define IOS()
#else
#define bug(...)
#define IOS() ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
#endif
const int maxn = 503;

#ifdef BALBIT
int count_common_roads(vector<int> x){
	return {};

}

#endif

vector<pii> g[maxn];
int par[maxn];
int find(int x){return x==par[x]?x:par[x]=find(par[x]);}
bool fun[maxn];
vector<int> spn(vector<int> a){
	memset(fun, 0, sizeof fun);
	for (int x : a) par[x] = x, fun[x] = 1;
	vector<int>re;
	for (int x : a) {
		for (pii u : g[x]) {
			if (fun[u.f] && find(u.f)!=find(x)) {
				par[find(u.f)]=find(x);
				re.pb(u.s);
			}
		}
	}
	return re;
}

vector<int> find_roads(int n, vector<int> UU, vector<int> VV) {
	int m = SZ(UU);
	vector<int> re;
	for (int i = 0; i<m; ++i) {
		g[UU[i]].pb({VV[i], i});
		g[VV[i]].pb({UU[i], i});
	}
	for (int i = 0; i<n-1; ++i) {
		vector<int> tmp, tmp2;
		for (int j = 0; j<n; ++j) {
			(j>i?tmp:tmp2).pb(j);
		}
		vector<int> T = spn(tmp);
		vector<int> T2 = spn(tmp2);
		for (int x : T2) T.pb(x);
		int IT = 0;
		vector<int> vl;
		for (pii u : g[i]){
			if(u.f > i) {
				vector<int> tt = T; tt.pb(u.s);
				vl.pb(count_common_roads(tt));
			}
		}
		int bar = *max_element(ALL(vl));

		for (pii u : g[i]){
			if(u.f > i) {
				if (vl[IT] == bar) {
					re.pb(u.s);
				}
				++IT;
			}
		}
	}
	return re;
}

#ifdef BALBIT
signed main(){
	IOS();

	
}
#endif

Compilation message

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:72:11: error: 'count_common_roads' was not declared in this scope
   72 |     vl.pb(count_common_roads(tt));
      |           ^~~~~~~~~~~~~~~~~~