제출 #127653

#제출 시각아이디문제언어결과실행 시간메모리
127653chubyxdxdSimurgh (IOI17_simurgh)C++11
0 / 100
2 ms256 KiB
#include "simurgh.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> ii; std::vector<int> find_roads(int n, std::vector<int> u, std::vector<int> v){ ll tam=u.size(); //initset(tam); map<ll,ii> mp; set<ll> se; for(ll i=0; i<tam; i++){ //unionset(u[i],v[i]); mp[i]=ii(v[i],u[i]); } vector<int> r; //int f=0; //cout<<(1<<tam)<<endl; for(ll i=pow(2,n-1)-1;i<(1<<tam);i++){ ll h=__builtin_popcount(i); //cout<<i<<" tiene "<<h<<" bits prendidos "<<endl; if(h!=n-1){ continue; } else{ se.clear(); r.clear(); //cout<<i<<" = "<<h<<endl; for(ll j=0;j<tam;j++){ if(i&(1<<j)){ r.push_back(j); } } ll l=r.size(); /*for(int j=0;j<l;j++){ cout<<r[j]<<" "; } cout<<endl;*/ for(ll j=0;j<l;j++){ se.insert(mp[r[j]].first); se.insert(mp[r[j]].second); } ll k=se.size(); if(k==n){ //f++; //cout<<i<<endl; ll common=count_common_roads(r); if(common==n-1){ //cout<<f<<endl; return r; } } } } return r; //int common=count_common_roads(r); }
#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...