#include <bits/stdc++.h>
#include "simurgh.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:18:12: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
int m = l + r >> 1;
~~^~~
simurgh.cpp:21:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
correct |
2 |
Incorrect |
2 ms |
256 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |