Submission #959338

#TimeUsernameProblemLanguageResultExecution timeMemory
959338Darren0724"The Lyuboyn" code (IZhO19_lyuboyn)C++17
100 / 100
162 ms5460 KiB
#include <bits/stdc++.h> using namespace std; #define LCBorz ios_base::sync_with_stdio(false); cin.tie(0); #define int long long #define all(x) x.begin(), x.end() #define endl '\n' const int N=200005; const int INF=1e18; int32_t main() { LCBorz; int n,k,t;cin>>n>>k>>t; if(k%2==0){ cout<<-1<<endl; return 0; } string str;cin>>str; int s=0; for(char c:str){ s=s<<1|(c&1); } vector<int> v(n+2); for(int i=0;i<=k;i++){ v[i]=(1<<k+1)-(1<<i)-1; //01110 //01101 //01011 //00111 //10011 } for(int i=k+1;i<n;i++){ v[i]=(1<<i)+(1<<k-1)-1; } cout<<(1<<n)<<endl; for(int i=1;i<=(1<<n);i++){ for(int j=n-1;j>=0;j--){ cout<<((s>>j)&1); } cout<<endl; int p=__lg(i&(-i)); s^=v[p]; } return 0; }

Compilation message (stderr)

lyuboyn.cpp: In function 'int32_t main()':
lyuboyn.cpp:24:19: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   24 |         v[i]=(1<<k+1)-(1<<i)-1;
      |                  ~^~
lyuboyn.cpp:32:26: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   32 |         v[i]=(1<<i)+(1<<k-1)-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...