#include "highway.h"
#include <bits/stdc++.h>
using namespace std;
map <pair<int, int>, int> mp;
vector <int> g[1001];
vector<int> to_ask(1001);
int now;
int check(int x, int p){
bool ok = 0;
for(auto y : g[x]){
if(p == y)
continue;
to_ask[mp[{min(x, y), max(y, x)}]] = 1;
// cout << x << " " << y << " " << ask(to_ask) <<" " << now << " " <<"\n";
int noww = ask(to_ask);
if(now == noww)
to_ask[mp[{min(x, y), max(y, x)}]] = 0;
else{
now = noww;
return check(y, x);
}
}
return x;
}
void find_pair(int N, vector<int> u, vector<int> v, int a, int b) {
int m = u.size();
to_ask.resize(m);
for(int i = 0; i < m; i ++){
g[u[i]].push_back(v[i]);
g[v[i]].push_back(u[i]);
mp[{min(u[i], v[i]), max(u[i], v[i])}] = i;
}
now = ask(to_ask);
answer(0, check(0, 0));
}
Compilation message
highway.cpp: In function 'int check(int, int)':
highway.cpp:10:10: warning: unused variable 'ok' [-Wunused-variable]
10 | bool ok = 0;
| ^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
1 ms |
328 KB |
Output is correct |
4 |
Correct |
1 ms |
328 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 ms |
328 KB |
Output is correct |
7 |
Correct |
1 ms |
200 KB |
Output is correct |
8 |
Correct |
1 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
1 ms |
328 KB |
Output is correct |
12 |
Correct |
2 ms |
200 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
328 KB |
Output is correct |
2 |
Runtime error |
11 ms |
772 KB |
Execution killed with signal 11 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
17 ms |
1164 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
328 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
15 ms |
832 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
9 ms |
820 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |