#include <bits/stdc++.h>
#include "simurgh.h"
//#include "grader.cpp"
using namespace std ;
const int MAX = 504 ;
int par[MAX] , sz[MAX] ;
void init()
{
for(int i = 0 ; i < MAX ; ++i)
par[i] = i , sz[i] = 1 ;
}
int root(int node)
{
if(par[node] == node)
return node ;
return (par[node] = root(par[node])) ;
}
void Union(int x , int y)
{
int a = root(x) ;
int b = root(y) ;
if(sz[a] < sz[b])
swap(a , b) ;
par[b] = a ;
sz[a] += sz[b] ;
}
std::vector<int> find_roads(int n, vector<int> u, vector<int> v)
{
int m = u.size() ;
//init() ;
vector<int>vv ;
vector<int>ans ;
for(int i = 0 ; i < m ; ++i)
{
//if(root(u[i]) == root(v[i]))
// continue ;
vv.clear() ;
for(int j = 0 ; j < n-1 ; ++j)
vv.push_back(i) ;
int x = count_common_roads(vv) ;
if(x)
{
Union(u[i] , v[i]) ;
ans.push_back(i) ;
}
}
return ans ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
correct |
2 |
Incorrect |
0 ms |
256 KB |
WA in grader: NO |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
WA in grader: NO |
2 |
Halted |
0 ms |
0 KB |
- |