제출 #128384

#제출 시각아이디문제언어결과실행 시간메모리
128384chubyxdxdSimurgh (IOI17_simurgh)C++11
0 / 100
3 ms376 KiB
#include "simurgh.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> ii; vector<int> p (22); void initset(int x){ p.assign(22,0); for(int i=0;i<=x;i++){ p[i]=i; } } int find(int u){ if(u==p[u]) return u; else return find(p[u]); } /*bool issameset(int u,int v){ return find(u)==find(v); }*/ void unionset(int u,int v){ u=find(u); v=find(v); if(u!=v){ p[v]=u; } } std::vector<int> find_roads(int n, std::vector<int> u, std::vector<int> v){ int tam=v.size(); //initset(tam); map<int,ii> mp; set<int> se; for(int i=0; i<tam; i++){ //unionset(u[i],v[i]); mp[i]=ii(u[i],v[i]); //cout<<i<<" = "<<u[i]<<" "<<v[i]<<endl; } int c=0; for(int i=pow(2,n-1)-1;i<(1<<tam);i++){ if(__builtin_popcount(i)==n-1){ c++; //cout<<i<<" "<<c<<endl; se.clear(); vector<int> r; //cout<<i<<" = "<<h<<endl; initset(n); for(ll j=0;j<tam;j++){ if(i&(1<<j)){ r.push_back(j); unionset(u[j],v[j]); } } vector<int> f; int h=r.size(); for(int j=0;j<h;j++){ f.push_back(p[r[j]]); } //int l=r.size(); f.erase(unique(f.begin(),f.end()),f.end()); int sw=f.size(); f.clear(); if(sw==1){ ll common=count_common_roads(r); if(common==n-1){ return r; } } } } //return r; //int common=count_common_roads(r); }

컴파일 시 표준 에러 (stderr) 메시지

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:73:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...