Submission #345864

#TimeUsernameProblemLanguageResultExecution timeMemory
345864oleh1421"The Lyuboyn" code (IZhO19_lyuboyn)C++17
3 / 100
266 ms7892 KiB
//#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> typedef long long ll; using namespace std; #define endl '\n' const int N=1010; const ll mod=1000000007; void print(int x,int n){ for (int i=n-1;i>=0;i--){ cout<<(x>>i)%2; } cout<<endl; } void solve(){ int n,k,t;cin>>n>>k>>t; string str;cin>>str; int F0=0; for (auto i:str){ F0*=2; F0+=i-'0'; } vector<int>basis; vector<int>real_basis; for (int i=0;i<(1<<n);i++){ if (__builtin_popcount(i)==k){ int x=i; for (int y:basis){ x=min(x,x^y); } if (x) basis.push_back(x),real_basis.push_back(i); } } if (basis.size()!=n){ cout<<-1<<endl; return; } vector<int>pref; for (int i=0;i<n;i++){ vector<int>nw=pref; nw.push_back(real_basis[i]); for (int x:pref) nw.push_back(x); pref=nw; } print(F0,n); for (int x:pref){ F0^=x; print(F0,n); } } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int tt=1; while (tt--){ solve(); } return 0; }

Compilation message (stderr)

lyuboyn.cpp: In function 'void solve()':
lyuboyn.cpp:34:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |     if (basis.size()!=n){
      |         ~~~~~~~~~~~~^~~
#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...