Submission #895634

#TimeUsernameProblemLanguageResultExecution timeMemory
895634mychecksedad"The Lyuboyn" code (IZhO19_lyuboyn)C++17
69 / 100
276 ms7020 KiB
/* Author : Mychecksdead */ #include<bits/stdc++.h> using namespace std; #define ll long long int #define MOD (1000000000+7) #define MOD1 (998244353) #define pb push_back #define all(x) x.begin(), x.end() #define en cout << '\n' const int N = 1e6+100, M = 1e5+10, K = 52, MX = 30; int n, k, t, b = 0; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void solve(){ cin >> n >> k >> t; for(int i = n-1; i >= 0; --i){ char c; cin >> c; b += (1<<i)*(c=='1'); } vector<int> s, base; for(int i = 0; i < (1<<n); ++i) if(__builtin_popcount(i) == k) base.pb(i); bool ok = 0; int sz = base.size() - 1; for(int rep = 0; rep < 100; ++rep){ vector<bool> used(1<<n); s.clear(); used[0] = 1; for(int j = 0; j < n; ++j){ int mask = 0; while(used[mask]){ mask = base[uniform_int_distribution<int>(0,sz)(rng)]; } s.pb(mask); used[mask] = 1; } ok = 1; for(int mask = 1; mask < (1<<n); ++mask){ int x = 0; for(int j = 0; j < n; ++j){ if((1<<j)&mask){ x ^= s[j]; } } if(x == 0){ ok = 0; break; } } if(ok) break; } if(!ok){ cout << -1; return; } // for(int x: s) cout << x << ' '; vector<int> cur; cur.pb(0); for(int i = 0; i < n; ++i){ vector<int> t; for(int j = cur.size() - 1; j >= 0; --j){ t.pb(cur[j]^s[i]); } for(int x: t) cur.pb(x); } cout << (1<<n) << '\n'; for(int x: cur){ int num = x^b; for(int j = (n-1); j >= 0; --j){ cout << (((1<<j)&num)>0); } en; } } int main(){ cin.tie(0); ios::sync_with_stdio(0); int tt = 1, aa; // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); // cin >> tt; while(tt--){ solve(); // en; en; } cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" seconds\n"; return 0; }

Compilation message (stderr)

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:83:15: warning: unused variable 'aa' [-Wunused-variable]
   83 |   int tt = 1, aa;
      |               ^~
#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...