#include "simurgh.h"
#ifndef EVAL
#include "grader.cpp"
#endif
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(),x.rend()
#define NeedForSpeed ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vii;
typedef vector<pll> vpll;
typedef vector<pii> vpii;
template<class T> bool umin(T& a, const T& b) {return a > b? a = b, true:false;}
template<class T> bool umax(T& a, const T& b) {return a < b? a = b, true:false;}
int msb(int val){return sizeof(int)*8-__builtin_clzll(val)-1;}
const int N = 105;
const int mod = 1e9+7;
const ll inf = 1e18;
const ld Pi = acos(-1);
int used[N], ue[N], ans, nn, mm;
vpii edges[N];
vii qq;
void dfs(int u){
used[u] = 1;
for(auto x:edges[u]){
if(used[x.ff]) continue;
ue[x.ss] = 1;
qq.pb(x.ss);
dfs(x.ff);
}
}
vii ss, res;
int fix[N];
void find (int u, pii gg, int p = -1){
if(!res.empty()) return;
if(u == gg.ff){
//res.pb(gg);
int last = sz(ss)-1;
while(last >= 0) res.pb(ss[last]), last--;
return;
}used[u] = 1;
for(auto x:edges[u]){
if(p == x.ff) continue;
if(ue[x.ss]){
//if(!fix[x.ss])
ss.pb(x.ss);
find(x.ff, gg, u);
}
}ss.pop_back();
}
vector<int> find_roads(int n, vector<int> u, vector<int> v) {
nn = n, mm = sz(u);
//cout<<"\n";
for(int i=0;i<sz(u);i++){
edges[u[i]].pb({v[i], i});
edges[v[i]].pb({u[i], i});
//cout<<u[i]<<" "<<v[i]<<" "<<i<<"\n";
}
dfs(0);
int ans = count_common_roads(qq);
//for(auto x:qq) cout<<x<<" ";
//cout<<"\n";
vii rr;
for(int i=0;i<sz(u);i++){
if(ue[i]) continue;
ss.clear(), res.clear();
find(u[i], {v[i], i});
ue[i] = 1;
//cout<<i<<"\n";
//for(auto x:res) cout<<x<<" ";
//cout<<"\n";
vpii tres;
//for(int i=0;i<mm;i++) cout<<ue[i]<<" ";
//cout<<"\n";
for(auto x:res){
ue[x] = 0;
vii tt;
//for(int i=0;i<mm;i++) cout<<ue[i]<<" ";
//cout<<"\n";
for(int i=0;i<mm;i++) if(ue[i]) tt.pb(i);
int tmp = count_common_roads(tt);
tres.pb({tmp, x});
ue[x] = 1;
}
sort(all(tres));
if(tres[0] == tres.back()) continue;
fix[tres[0].ss] = 2;
if(tres[0].ff == ans) fix[i] = 2;
else fix[i] = 1;
ue[i] = 0;
for(int i=1;i<sz(tres);i++){
fix[tres[i].ss] = 1;
if(tres[i].ff > tres[i-1].ff) continue;
fix[tres[i].ss] = 2;
}
memset(used, 0, sizeof used);
}
for(int i=0;i<m;i++){
if(fix[i] == 2 || fix[i] == 0) rr.pb(i);
}
return rr;
}
/*
5 7
0 1
0 2
1 2
2 3
2 4
3 4
1 4
0
2
4
5
*/
Compilation message
simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:130:16: error: 'm' was not declared in this scope
130 | for(int i=0;i<m;i++){
| ^