Submission #128431

#TimeUsernameProblemLanguageResultExecution timeMemory
128431chubyxdxdSimurgh (IOI17_simurgh)C++11
13 / 100
28 ms396 KiB
#include "simurgh.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> ii; int p[22]; void initset(int x){ for(int i=0;i<x;i++){ p[i]=i; } } int finds(int u){ if(u==p[u]) return u; p[u]=finds(p[u]); return p[u]; } /*bool issameset(int u,int v){ return find(u)==find(v); }*/ int unionset(int u,int v){ u=finds(u); v=finds(v); if(u!=v){ p[u]=v; return 1; } return 0; } std::vector<int> find_roads(int n, std::vector<int> u, std::vector<int> v){ int tam=v.size(); //int c=0; for(int i=0;i<(1<<tam);i++){ if(__builtin_popcount(i)==n-1){ vector<int> r; initset(n); int sw=0; for(ll j=0;j<tam;j++){ if(i&(1<<j)){ r.push_back(j); if(unionset(u[j],v[j])==0){ sw=1; break; } } } //f.clear(); if(sw==0){ int common=count_common_roads(r); if(common==n-1){ return r; } r.clear(); } } } //return r; //int common=count_common_roads(r); }

Compilation message (stderr)

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:59: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...