제출 #134597

#제출 시각아이디문제언어결과실행 시간메모리
134597dvdg6566Simurgh (IOI17_simurgh)C++14
0 / 100
2 ms504 KiB
#include "simurgh.h" #include<bits/stdc++.h> using namespace std; typedef pair<int,int> pi; typedef vector<int> vi; typedef vector<pi> vpi; #define pb emplace_back #define mp make_pair #define f first #define s second #define SZ(x) (int)x.size() #define ALL(x) x.begin(),x.end() #define MAXN 241 int N,a,b; vpi V[MAXN]; vpi edgeList; vi res,cur; vpi tmp; int p[MAXN]; int par(int x){return (x==p[x])?x:p[x] = par(p[x]);} std::vector<int> find_roads(int n, std::vector<int> u, std::vector<int> v) { N=n; for (int i=0;i<SZ(u);++i){ a=u[i];b=v[i]; V[a].pb(b,i);V[b].pb(a,i); edgeList.pb(a,b); } for (int i=0;i<N;++i){ // We want to find all edges with index to a bigger node for (int j=0;j<N;++j)p[j]=j; cur.clear(); tmp.clear(); for (int j=0;j<SZ(edgeList);++j){ pi it = edgeList[j]; if (it.f == i || it.s == i)continue; if (par(it.f) == par(it.s))continue; p[par(it.f)] = par(it.s); cur.pb(j); } // cout<<SZ(cur)<<'\n'; for (auto x : V[i]){ cur.pb(x.s); int t = count_common_roads(cur); tmp.pb(x.s,t); cur.pop_back(); } int lowest = 1e9; for (auto x : tmp)lowest = min(lowest,x.s); for (auto x : tmp){ if (x.s > lowest)res.pb(x.f); } // for (auto x:res)cout<<x<<' ';cout<<'\n'; } sort(ALL(res)); res.resize(unique(ALL(res)) - res.begin()); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...