QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#369734#8174. Set ConstructionzlxFTHWA 1ms3804kbC++14783b2024-03-28 17:11:162024-03-28 17:11:16

Judging History

你现在查看的是最新测评结果

  • [2024-03-28 17:11:16]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3804kb
  • [2024-03-28 17:11:16]
  • 提交

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