QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#549495#8174. Set ConstructionHuTaoWA 4ms3956kbC++14818b2024-09-06 16:27:012024-09-06 16:27:02

Judging History

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

  • [2024-09-06 16:27:02]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3956kb
  • [2024-09-06 16:27:01]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int N = 2005;

int n, m;
LL a[N];

inline void Work(int L, int R, int n)
{
    if(R == L + 1)
    {
        a[L] = 0, a[L + 1] = (1LL << n) - 1;
    }
    else if((R - L + 1) & 1)
    {
        a[L] = 0;
        Work(L + 1, R, n - 1);
        for(int i = L + 1; i <= R; i ++ ) a[i] = a[i] << 1 | 1;
    }
    else
    {
        int k = (R - L + 1) >> 1;
        Work(L, L + k - 1, n - 1);
        for(int i = L; i <= L + k - 1; i ++ ) a[i + k] = a[i] | 1 << (n - 1);
    }
}

int main()
{
    int T;
    scanf("%d", &T);
    while(T -- )
    {
        scanf("%d%d", &n, &m);
        Work(1, m, n);
        for(int i = 1; i <= m; i ++ ) printf("%lld ", a[i]);
        puts("");
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3956kb

input:

3
3 5
4 8
60 2

output:

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

result:

ok AC

Test #2:

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

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 
0 1 63 
0 31 32 63 
0 1 31 33 63 
0 1 31 32 33 63 
0 1 3 31 33 35 63 
0 15 16 31 32 47 48 63 
0 1 15 17 31 33 47 49 63 
0 1 15 17 31 32 33 47 49 63 
0 1 3 15 19 31 33 35 47 51 63 
0 1 15 16 17 31 32 33 47 48 49 63 
0 1 3 15 17 19 31 33 35 47 49 51 63 
0 1 3 15 17 19 31 32 33 35 47 49 51 63 
0 ...

result:

ok AC

Test #3:

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

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:

0 1 31 32 33 63 64 65 95 96 97 127 
0 1 3 31 33 35 63 65 67 95 97 99 127 
0 1 3 31 33 35 63 64 65 67 95 97 99 127 
0 1 3 7 31 35 39 63 65 67 71 95 99 103 127 
0 15 16 31 32 47 48 63 64 79 80 95 96 111 112 127 
0 1 15 17 31 33 47 49 63 65 79 81 95 97 111 113 127 
0 1 15 17 31 33 47 49 63 64 65 79 81 ...

result:

ok AC

Test #4:

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

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:

0 1 3 7 63 67 71 127 129 131 135 191 195 199 255 
0 31 32 63 64 95 96 127 128 159 160 191 192 223 224 255 
0 1 31 33 63 65 95 97 127 129 159 161 191 193 223 225 255 
0 1 31 33 63 65 95 97 127 128 129 159 161 191 193 223 225 255 
0 1 3 31 35 63 67 95 99 127 129 131 159 163 191 195 223 227 255 
0 1 31...

result:

ok AC

Test #5:

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

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:

0 1 127 129 255 256 257 383 385 511 
0 1 3 127 131 255 257 259 383 387 511 
0 1 127 128 129 255 256 257 383 384 385 511 
0 1 3 127 129 131 255 257 259 383 385 387 511 
0 1 3 127 129 131 255 256 257 259 383 385 387 511 
0 1 3 7 127 131 135 255 257 259 263 383 387 391 511 
0 63 64 127 128 191 192 255 ...

result:

ok AC

Test #6:

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

input:

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

output:

0 1 31 33 63 64 65 95 97 127 128 129 159 161 191 192 193 223 225 255 256 257 287 289 319 320 321 351 353 383 384 385 415 417 447 448 449 479 481 511 
0 1 3 31 35 63 65 67 95 99 127 129 131 159 163 191 193 195 223 227 255 257 259 287 291 319 321 323 351 355 383 385 387 415 419 447 449 451 479 483 511...

result:

ok AC

Test #7:

score: -100
Wrong Answer
time: 4ms
memory: 3768kb

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:

0 1 3 7 15 2251799813685247 524295 524303 2251799813685247 1048579 1048583 1048591 2251799813685247 1572871 1572879 2251799813685247 2097155 2097159 2097167 2251799813685247 2621447 2621455 2251799813685247 3145731 3145735 3145743 2251799813685247 3670023 3670031 2251799813685247 4194307 4194311 419...

result:

wrong answer Outputs are not distinct