QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#369734 | #8174. Set Construction | zlxFTH | WA | 1ms | 3804kb | C++14 | 783b | 2024-03-28 17:11:16 | 2024-03-28 17:11:16 |
Judging History
answer
#include <iostream>
#include <vector>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using LL = long long;
void solve() {
int n, m;
scanf("%d%d", &n, &m);
std::vector<LL> ans;
m -= 2, ans = {0, (1ll << n) - 1};
for (int i = 0; i < n && m; ++i) {
for (int j = i; j >= 0; --j) {
for (LL s = (1ll << i) - 1; s >= 0; --s) {
if (__builtin_popcountll(s) == j) {
LL v = 1ll << i;
for (int k = 0; k < n; ++k)
if (s >> k & 1) v |= (1ll << k);
if (v != (1ll << n) - 1) ans.push_back(v), --m;
if (m == 0) goto tpw1;
}
}
}
}
tpw1:
for (auto x : ans) printf("%lld ", x);
puts("");
}
int main() {
int t; scanf("%d", &t);
while (t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3804kb
input:
3 3 5 4 8 60 2
output:
0 7 1 3 2 0 15 1 3 2 7 6 5 0 1152921504606846975
result:
wrong answer (5 AND 6) is not in A