#include "highway.h"
#include<bits/stdc++.h>
using namespace std;
int d ;
vector<int>adj[101];
bool indepth(int u , int p){
if(u == d)return true ;
for(auto f : adj[u]){
if(f == p)continue ;
if(indepth(f , u))return true ;
}
return false ;
}int sz[101] , parent[101];
void dfs(int u , int p , int dd){
sz[u] = dd ;
parent[u] = p;
for(auto f : adj[u]){
if(f == p)continue ;
dfs(f , u , dd + 1);
}
}
int b[101];
void dfs2(int u, int p){
for(auto f : adj[u]){
if(f == p)continue ;
if(indepth(f , u))dfs2(f , u) , b[f] = 1 ;
}
}
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B) {
int M = U.size();
for(int i = 0 ; i < M ; i ++)
adj[U[i]].push_back(V[i]) , adj[V[i]].push_back(U[i]);
dfs(0 , -1 , 0);
int ans = 0 ;
for (int j = 1; j <= N; ++j) {
vector<int> w;
memset(b , 0 , sizeof b);
d = j ;
dfs2(j , parent[j]);
for(int i = 0 ; i < M ; i ++){
if(b[U[i]] + b[V[i]] == 2)w.push_back(1);
else w.push_back(0);
}
long long toll = ask(w);
if(toll == sz[j] * A){
ans = j ;
break;
}
}
answer(0, ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
384 KB |
Output is incorrect: {s, t} is wrong. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
9 ms |
768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
10 ms |
768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
11 ms |
768 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |