Submission #341129

#TimeUsernameProblemLanguageResultExecution timeMemory
341129juggernaut"The Lyuboyn" code (IZhO19_lyuboyn)C++14
100 / 100
502 ms5652 KiB
#include<bits/stdc++.h> using namespace std; char _S[20]; int B[262144],n,k,t; int main() { ios_base::sync_with_stdio(0);cin.tie(0); cin>>n>>k>>t>>_S; if(k+1&1){ puts("-1"); return 0; } int S=0; for(int i=0;i<n;i++)S=S<<1|_S[i]-'0'; for(int i=0;i<=k;i++) B[1<<i]=(1<<k+1)-(1<<i)-1; for(int i=k+1;i<n;i++) B[1<<i]=(1<<k-1)+(1<<i)-1; printf("%d\n",1<<n); for(int i=0;i<(1<<n);i++){ S^=B[i&-i]; for(int j=n;j--;)printf("%d",(S>>j)&1); puts(""); } }

Compilation message (stderr)

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:8:9: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
    8 |     if(k+1&1){
      |        ~^~
lyuboyn.cpp:13:37: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
   13 |     for(int i=0;i<n;i++)S=S<<1|_S[i]-'0';
      |                                ~~~~~^~~~
lyuboyn.cpp:15:22: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   15 |         B[1<<i]=(1<<k+1)-(1<<i)-1;
      |                     ~^~
lyuboyn.cpp:17:22: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   17 |         B[1<<i]=(1<<k-1)+(1<<i)-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...