#include <bits/stdc++.h>
#define pii pair<int, int>
#define F first
#define S second
using namespace std;
vector<int> ans;
//int count_common_roads(vector<int> v) {
// for(auto it: v) cout << it << ' '; cout << endl;
// int a; cin >> a; return a;
//}
int dfs(int l, int r) {
vector<int> que;
for(int i = l; i <= r; i ++) que.push_back(i);
int v = count_common_roads(que);
if(!v) return 0;
if(v == r - l + 1) return ans.insert(ans.end(), que.begin(), que.end()), v;
int m = l + r >> 1;
int k = dfs(l, m);
if(k != v) dfs(m + 1, r);
}
vector<int> find_roads(int n, vector<int> u, vector<int> v) {
dfs(0, u.size() - 1);
return ans;
}
//main () {
// vector<int> ans = find_roads(4, {0, 0, 0, 1, 1, 2}, {1, 2, 3, 2, 3, 3});
// for(auto it: ans) cout << it << ' '; cout << endl;
//}
Compilation message
simurgh.cpp: In function 'int dfs(int, int)':
simurgh.cpp:14:10: error: 'count_common_roads' was not declared in this scope
int v = count_common_roads(que);
^~~~~~~~~~~~~~~~~~
simurgh.cpp:17:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
int m = l + r >> 1;
~~^~~
simurgh.cpp:20:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^