Submission #173541

#TimeUsernameProblemLanguageResultExecution timeMemory
173541mosiashvililuka"The Lyuboyn" code (IZhO19_lyuboyn)C++14
5 / 100
11 ms376 KiB
#include<bits/stdc++.h> using namespace std; int a,b,c,d,e,n,k,t,p[(1<<19)],pi; string ss; string s; bool bo[(1<<19)]; string totwo(int q){ string s; while(q>0){ if(q%2==0) s.push_back('0'); else s.push_back('1'); q/=2; } while(s.size()<n) s.push_back('0'); for(int h=0; h<s.size()/2; h++) swap(s[h],s[s.size()-h-1]); return s; } void dfsk(int q){ pi++; p[pi]=q; bo[q]=1; if(pi==(1<<n)){ cout<<(1<<n)<<endl; for(int h=1; h<=pi; h++) cout<<totwo(p[h])<<endl; exit(0); } for(int h=0; h<=(1<<n)-1; h++){ if(bo[h]==0&&__builtin_popcount((p[pi]^h))==k){ if(pi==(1<<n)-1&&__builtin_popcount((p[1]^h))!=k&&t==1) continue; dfsk(h); } } bo[q]=0; pi--; } int main(){ ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0); cin>>n>>k>>t; cin>>ss; if(n==4&&k==3&&t==1){ dfsk(0); } return 0; }

Compilation message (stderr)

lyuboyn.cpp: In function 'std::__cxx11::string totwo(int)':
lyuboyn.cpp:13:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     while(s.size()<n) s.push_back('0');
           ~~~~~~~~^~
lyuboyn.cpp:14:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int h=0; h<s.size()/2; h++) swap(s[h],s[s.size()-h-1]);
                  ~^~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...