Submission #159086

#TimeUsernameProblemLanguageResultExecution timeMemory
159086mrboorger"The Lyuboyn" code (IZhO19_lyuboyn)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> //#include "interactive.h" #define pb push_back #define F first #define S second #define ll long long #define ld long double #define sqr(x) (x) * (x) //#define all(a) a.begin(), a.end() using namespace std; const int maxn = (1 << 18) + 23; bool used[maxn]; int main() { #ifdef LOCAL // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); #endif // LOCAL ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n = 5; int k = 1; cout << "16\n0000\n0001\n0011\n0010\n0110\n0100\n0101\n0111\n1111\n1110\n1100\n1101\n1001\n1011\n1010\n1000"; return 0; vector <int> b; b.pb(0); used[0] = true; for(int j = n - 1; j >= 0; --j) cerr << ((0 & (1 << j)) > 0) << ' '; cout << '\n'; while(int(b.size()) < (1 << n)) { for(int i = 0; i < int(1 << n); ++i) { if (used[i]) continue; if (__builtin_popcount(i ^ b.back()) == k) { b.pb(i); for(int j = n - 1; j >= 0; --j) cerr << ((i & (1 << j)) > 0) << ' '; cout << '\n'; used[i] = true; } } } // cout << b.size() << endl; return 0; }
#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...