# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
105020 | bert30702 | Simurgh (IOI17_simurgh) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
//}