Submission #744887

#TimeUsernameProblemLanguageResultExecution timeMemory
744887sword060Hiperkocka (COCI21_hiperkocka)C++17
0 / 110
2 ms3284 KiB
#include <bits/stdc++.h> using namespace std; const int N=1<<16; int x; vector<int>all; set<int>v[N]; set<vector<int>>ans; int main(){ ios::sync_with_stdio(0);cin.tie(0); srand(time(NULL)); cin>>x; for(int i=1;i<=x;i++){ int l,r;cin>>l>>r; v[l].insert(r);v[r].insert(l); } all.push_back(-1); for(int i=0;i<(1<<x);i++) all.push_back(i); for(int rep=0;rep<(1<<(x+1));rep++){ random_shuffle(all.begin()+1,all.end()); vector<int>cur; bool f=1; for(int i=1;i<=x+1;i++){ cur.push_back(all[i]); for(int j=i+1;j<=x+1;j++){ int m=all[i]^all[j]; bool f1=v[all[i]].count(all[j])+v[all[j]].count(all[j]),f2=((m&(m-1))==0); if(f1&&!f2)f=0; } } if(f){ sort(cur.begin(),cur.end()); ans.insert(cur); } if(ans.size()==(1<<(x-1)))break; } cout<<(ans.size())<<"\n"; for(auto i:ans){ for(auto j:i)cout<<j<<" "; cout<<"\n"; } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:35:18: warning: comparison of integer expressions of different signedness: 'std::set<std::vector<int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |     if(ans.size()==(1<<(x-1)))break;
      |        ~~~~~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...