This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 = 4;
int k = 1;
cout << "0 1 3 7 15 11 9 13 5 4 6 14 10 2 0 8 12 17";
return 0;
vector <int> a;
for(int i = 0; i < (1 << n); ++i)
a.pb(i);
vector <int> b;
b.pb(0);
cerr << b.back() << ' ';
while(int(b.size()) < (1 << n))
{
for(int i = 0; i < int(a.size()); ++i)
{
if (used[i]) continue;
if (__builtin_popcount(a[i] ^ b.back()) == k)
{
b.pb(a[i]);
cerr << b.back() << ' ';
used[i] = true;
}
}
}
cerr << b.size() << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |