QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#427068#8174. Set ConstructionMade_in_CodeWA 4ms3744kbC++14765b2024-06-01 09:03:082024-06-01 09:03:09

Judging History

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

  • [2024-06-01 09:03:09]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3744kb
  • [2024-06-01 09:03:08]
  • 提交

answer

#include <iostream>
#include <vector>
#define LL long long

using namespace std;

int t, n, m;
vector<LL> l;

void Solve(int n, int m) {
  if (m == 2) {
    l.push_back(0), l.push_back(~(-1LL << n));
    return;
  }
  if (m & 1) {
    Solve(n - 1, m - 1);
    for (LL &i : l) {
      i += 1LL << n - 1;
    }
    l.push_back(0);
  } else {
    Solve(n - 1, m >> 1);
    for (int i = 0, j = l.size(); i < j; i++) {
      l.push_back(l[i] + (1LL << n - 1));
    }
  }
}

int main() {
  cin.tie(0), cout.tie(0);
  ios::sync_with_stdio(0);
  cin >> t;
  while (t--) {
    cin >> n >> m;
    l.clear(), Solve(n, m);
    for (int i = 0; i < l.size(); i++) {
      cout << l[i] << " \n"[i + 1 == l.size()];
    }
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3668kb

input:

3
3 5
4 8
60 2

output:

4 5 6 7 0
0 3 4 7 8 11 12 15
0 1152921504606846975

result:

ok AC

Test #2:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

30
6 2
6 3
6 4
6 5
6 6
6 7
6 8
6 9
6 10
6 11
6 12
6 13
6 14
6 15
6 16
6 17
6 18
6 19
6 20
6 21
7 2
7 3
7 4
7 5
7 6
7 7
7 8
7 9
7 10
7 11

output:

0 63
32 63 0
0 31 32 63
32 47 48 63 0
16 31 0 48 63 32
40 47 32 56 63 48 0
0 15 16 31 32 47 48 63
32 39 40 47 48 55 56 63 0
16 23 24 31 0 48 55 56 63 32
40 43 44 47 32 56 59 60 63 48 0
8 15 0 24 31 16 40 47 32 56 63 48
36 39 32 44 47 40 52 55 48 60 63 56 0
20 23 16 28 31 24 0 52 55 48 60 63 56 32
42...

result:

ok AC

Test #3:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

30
7 12
7 13
7 14
7 15
7 16
7 17
7 18
7 19
7 20
7 21
7 22
7 23
7 24
7 25
7 26
7 27
7 28
8 2
8 3
8 4
8 5
8 6
8 7
8 8
8 9
8 10
8 11
8 12
8 13
8 14

output:

16 31 0 48 63 32 80 95 64 112 127 96
72 79 64 88 95 80 104 111 96 120 127 112 0
40 47 32 56 63 48 0 104 111 96 120 127 112 64
84 87 80 92 95 88 64 116 119 112 124 127 120 96 0
0 15 16 31 32 47 48 63 64 79 80 95 96 111 112 127
64 71 72 79 80 87 88 95 96 103 104 111 112 119 120 127 0
32 39 40 47 48 55...

result:

ok AC

Test #4:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

30
8 15
8 16
8 17
8 18
8 19
8 20
8 21
8 22
8 23
8 24
8 25
8 26
8 27
8 28
8 29
8 30
8 31
8 32
8 33
8 34
8 35
8 36
9 2
9 3
9 4
9 5
9 6
9 7
9 8
9 9

output:

168 175 160 184 191 176 128 232 239 224 248 255 240 192 0
0 31 32 63 64 95 96 127 128 159 160 191 192 223 224 255
128 143 144 159 160 175 176 191 192 207 208 223 224 239 240 255 0
64 79 80 95 96 111 112 127 0 192 207 208 223 224 239 240 255 128
160 167 168 175 176 183 184 191 128 224 231 232 239 240...

result:

ok AC

Test #5:

score: 0
Accepted
time: 0ms
memory: 3732kb

input:

30
9 10
9 11
9 12
9 13
9 14
9 15
9 16
9 17
9 18
9 19
9 20
9 21
9 22
9 23
9 24
9 25
9 26
9 27
9 28
9 29
9 30
9 31
9 32
9 33
9 34
9 35
9 36
9 37
9 38
9 39

output:

128 191 192 255 0 384 447 448 511 256
320 351 352 383 256 448 479 480 511 384 0
64 127 0 192 255 128 320 383 256 448 511 384
288 319 256 352 383 320 416 447 384 480 511 448 0
160 191 128 224 255 192 0 416 447 384 480 511 448 256
336 351 320 368 383 352 256 464 479 448 496 511 480 384 0
0 63 64 127 1...

result:

ok AC

Test #6:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

6
9 40
9 41
9 42
9 43
9 44
9 45

output:

32 47 48 63 0 96 111 112 127 64 160 175 176 191 128 224 239 240 255 192 288 303 304 319 256 352 367 368 383 320 416 431 432 447 384 480 495 496 511 448
272 279 280 287 256 304 311 312 319 288 336 343 344 351 320 368 375 376 383 352 400 407 408 415 384 432 439 440 447 416 464 471 472 479 448 496 503 ...

result:

ok AC

Test #7:

score: 0
Accepted
time: 4ms
memory: 3724kb

input:

30
60 1801
60 1802
60 1803
60 1804
60 1805
60 1806
60 1807
60 1808
60 1809
60 1810
60 1811
60 1812
60 1813
60 1814
60 1815
60 1816
60 1817
60 1818
60 1819
60 1820
60 1821
60 1822
60 1823
60 1824
60 1825
60 1826
60 1827
60 1828
60 1829
60 1830

output:

613193236764164096 613333974252519423 613052499275808768 613474711740874752 613615449229230079 613333974252519424 612489549322387456 614319136671006720 614459874159362047 614178399182651392 614600611647717376 614741349136072703 614459874159362048 613615449229230080 615445036577849344 615585774066204...

result:

ok AC

Test #8:

score: 0
Accepted
time: 2ms
memory: 3640kb

input:

30
59 1741
59 1742
59 1743
59 1744
59 1745
59 1746
59 1747
59 1748
59 1749
59 1750
59 1751
59 1752
59 1753
59 1754
59 1755
59 1756
59 1757
59 1758
59 1759
59 1760
59 1761
59 1762
59 1763
59 1764
59 1765
59 1766
59 1767
59 1768
59 1769
59 1770

output:

333987652053237760 334005244239282175 333970059867193344 334022836425326592 334040428611371007 334005244239282176 334058020797415424 334075612983459839 334040428611371008 334093205169504256 334110797355548671 334075612983459840 333829322378838016 334269127029948416 334286719215992831 334251534843904...

result:

ok AC

Test #9:

score: 0
Accepted
time: 4ms
memory: 3712kb

input:

30
58 1682
58 1683
58 1684
58 1685
58 1686
58 1687
58 1688
58 1689
58 1690
58 1691
58 1692
58 1693
58 1694
58 1695
58 1696
58 1697
58 1698
58 1699
58 1700
58 1701
58 1702
58 1703
58 1704
58 1705
58 1706
58 1707
58 1708
58 1709
58 1710
58 1711

output:

76877853014097920 76913037386186751 76842668642009088 76948221758275584 76983406130364415 76913037386186752 77018590502453248 77053774874542079 76983406130364416 77088959246630912 77124143618719743 77053774874542080 76561193665298432 77440802967519232 77475987339608063 77405618595430400 775111717116...

result:

ok AC

Test #10:

score: -100
Wrong Answer
time: 1ms
memory: 3616kb

input:

30
2 2
2 3
3 2
3 3
3 4
3 5
3 6
4 2
4 3
4 4
4 5
4 6
4 7
4 8
4 9
4 10
5 2
5 3
5 4
5 5
5 6
5 7
5 8
5 9
5 10
5 11
5 12
5 13
5 14
5 15

output:

0 3
2 3 0
0 7
4 7 0
0 3 4 7
4 5 6 7 0
2 3 0 6 7 4
0 15
8 15 0
0 7 8 15
8 11 12 15 0
4 7 0 12 15 8
10 11 8 14 15 12 0
0 3 4 7 8 11 12 15
8 9 10 11 12 13 14 15 0
4 5 6 7 0 12 13 14 15 8
0 31
16 31 0
0 15 16 31
16 23 24 31 0
8 15 0 24 31 16
20 23 16 28 31 24 0
0 7 8 15 16 23 24 31
16 19 20 23 24 27 28 ...

result:

wrong answer Outputs are not distinct