QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#350012#8300. Game Designucup-team1209#AC ✓0ms3684kbC++201.2kb2024-03-10 12:10:252024-03-10 12:10:25

Judging History

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

  • [2024-03-10 12:10:25]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3684kb
  • [2024-03-10 12:10:25]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define drep(i,y,x) for (int i=(y);i>=(x);i--)
#define pii pair<int,int>
#define fir first
#define sec second
#define MP make_pair
template<typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;}
template<typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}
void file() {
    #ifdef zqj
    freopen("a.in","r",stdin);
    #endif
}
typedef long long ll;

int main() {
    file();
    // ios::sync_with_stdio(false),cin.tie(0);
    int K;
    cin>>K;
    if (K==1) {
        puts("2");
        puts("1");
        puts("1 2");
        return 0;
    }
    int k=30;
    while (!(K>>k&1)) --k;
    --k;
    static int fa[23333],w[23333];
    int n=1; w[1]=1;
    int tot=1;
    while (k>=0) {
        fa[n]=n+3,w[n+3]=1e9;
        fa[n+1]=n+2,fa[n+2]=n+3;
        w[n+1]=w[n+2]=1;
        n+=3;
        tot+=1;

        if (K>>k&1) {
            fa[n]=n+1,w[n+1]=tot;
            n++;
        }
        --k;
    }
    cout<<n<<'\n';
    rep(i,2,n) cout<<n+1-fa[n+1-i]<<" \n"[i==n];
    rep(i,1,n) cout<<w[n+1-i]<<" \n"[i==n];
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2

output:

4
1 2 1
1000000000 1 1 1

result:

ok correct

Test #2:

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

input:

1

output:

2
1
1 2

result:

ok correct

Test #3:

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

input:

3

output:

5
1 2 3 2
2 1000000000 1 1 1

result:

ok correct

Test #4:

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

input:

4

output:

7
1 2 1 4 5 4
1000000000 1 1 1000000000 1 1 1

result:

ok correct

Test #5:

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

input:

5

output:

8
1 2 3 2 5 6 5
3 1000000000 1 1 1000000000 1 1 1

result:

ok correct

Test #6:

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

input:

6

output:

8
1 2 1 4 5 6 5
1000000000 1 1 2 1000000000 1 1 1

result:

ok correct

Test #7:

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

input:

7

output:

9
1 2 3 2 5 6 7 6
3 1000000000 1 1 2 1000000000 1 1 1

result:

ok correct

Test #8:

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

input:

8

output:

10
1 2 1 4 5 4 7 8 7
1000000000 1 1 1000000000 1 1 1000000000 1 1 1

result:

ok correct

Test #9:

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

input:

9

output:

11
1 2 3 2 5 6 5 8 9 8
4 1000000000 1 1 1000000000 1 1 1000000000 1 1 1

result:

ok correct

Test #10:

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

input:

11

output:

12
1 2 3 2 5 6 7 6 9 10 9
4 1000000000 1 1 3 1000000000 1 1 1000000000 1 1 1

result:

ok correct

Test #11:

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

input:

23

output:

16
1 2 3 2 5 6 7 6 9 10 11 10 13 14 13
5 1000000000 1 1 4 1000000000 1 1 3 1000000000 1 1 1000000000 1 1 1

result:

ok correct

Test #12:

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

input:

64

output:

19
1 2 1 4 5 4 7 8 7 10 11 10 13 14 13 16 17 16
1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1

result:

ok correct

Test #13:

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

input:

87

output:

23
1 2 3 2 5 6 7 6 9 10 11 10 13 14 13 16 17 18 17 20 21 20
7 1000000000 1 1 6 1000000000 1 1 5 1000000000 1 1 1000000000 1 1 3 1000000000 1 1 1000000000 1 1 1

result:

ok correct

Test #14:

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

input:

103

output:

23
1 2 3 2 5 6 7 6 9 10 11 10 13 14 13 16 17 16 19 20 21 20
7 1000000000 1 1 6 1000000000 1 1 5 1000000000 1 1 1000000000 1 1 1000000000 1 1 2 1000000000 1 1 1

result:

ok correct

Test #15:

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

input:

128

output:

22
1 2 1 4 5 4 7 8 7 10 11 10 13 14 13 16 17 16 19 20 19
1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1

result:

ok correct

Test #16:

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

input:

325

output:

28
1 2 3 2 5 6 5 8 9 10 9 12 13 12 15 16 15 18 19 18 21 22 23 22 25 26 25
9 1000000000 1 1 1000000000 1 1 7 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 3 1000000000 1 1 1000000000 1 1 1

result:

ok correct

Test #17:

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

input:

567

output:

33
1 2 3 2 5 6 7 6 9 10 11 10 13 14 13 16 17 18 17 20 21 22 21 24 25 24 27 28 27 30 31 30
10 1000000000 1 1 9 1000000000 1 1 8 1000000000 1 1 1000000000 1 1 6 1000000000 1 1 5 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1

result:

ok correct

Test #18:

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

input:

9999

output:

47
1 2 3 2 5 6 7 6 9 10 11 10 13 14 15 14 17 18 17 20 21 20 23 24 23 26 27 26 29 30 31 30 33 34 35 34 37 38 39 38 41 42 41 44 45 44
14 1000000000 1 1 13 1000000000 1 1 12 1000000000 1 1 11 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 6 1000000000 1 1 5 1000000000 1 1 4 ...

result:

ok correct

Test #19:

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

input:

93256

output:

55
1 2 1 4 5 4 7 8 7 10 11 12 11 14 15 14 17 18 17 20 21 22 21 24 25 24 27 28 27 30 31 30 33 34 35 34 37 38 39 38 41 42 41 44 45 46 45 48 49 50 49 52 53 52
1000000000 1 1 1000000000 1 1 1000000000 1 1 14 1000000000 1 1 1000000000 1 1 1000000000 1 1 11 1000000000 1 1 1000000000 1 1 1000000000 1 1 100...

result:

ok correct

Test #20:

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

input:

3532462

output:

77
1 2 1 4 5 6 5 8 9 10 9 12 13 14 13 16 17 16 19 20 21 20 23 24 23 26 27 28 27 30 31 30 33 34 35 34 37 38 39 38 41 42 41 44 45 44 47 48 49 48 51 52 53 52 55 56 57 56 59 60 61 60 63 64 63 66 67 68 67 70 71 70 73 74 75 74
1000000000 1 1 21 1000000000 1 1 20 1000000000 1 1 19 1000000000 1 1 1000000000...

result:

ok correct

Test #21:

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

input:

54389236

output:

92
1 2 1 4 5 4 7 8 9 8 11 12 11 14 15 16 15 18 19 20 19 22 23 24 23 26 27 28 27 30 31 32 31 34 35 34 37 38 37 40 41 42 41 44 45 44 47 48 49 48 51 52 53 52 55 56 57 56 59 60 61 60 63 64 63 66 67 68 67 70 71 72 71 74 75 76 75 78 79 80 79 82 83 82 85 86 85 88 89 90 89
1000000000 1 1 1000000000 1 1 24 1...

result:

ok correct

Test #22:

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

input:

93453967

output:

95
1 2 3 2 5 6 7 6 9 10 11 10 13 14 15 14 17 18 17 20 21 20 23 24 23 26 27 28 27 30 31 30 33 34 35 34 37 38 39 38 41 42 43 42 45 46 47 46 49 50 51 50 53 54 55 54 57 58 59 58 61 62 63 62 65 66 65 68 69 68 71 72 71 74 75 76 75 78 79 78 81 82 81 84 85 86 85 88 89 90 89 92 93 92
27 1000000000 1 1 26 100...

result:

ok correct

Test #23:

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

input:

1000000000

output:

100
1 2 1 4 5 4 7 8 7 10 11 10 13 14 13 16 17 16 19 20 19 22 23 22 25 26 25 28 29 30 29 32 33 32 35 36 37 36 39 40 39 42 43 42 45 46 47 46 49 50 51 50 53 54 53 56 57 58 57 60 61 60 63 64 65 64 67 68 69 68 71 72 71 74 75 74 77 78 79 78 81 82 83 82 85 86 87 86 89 90 89 92 93 94 93 96 97 98 97
10000000...

result:

ok correct

Test #24:

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

input:

999999999

output:

108
1 2 3 2 5 6 7 6 9 10 11 10 13 14 15 14 17 18 19 18 21 22 23 22 25 26 27 26 29 30 31 30 33 34 35 34 37 38 37 40 41 40 43 44 45 44 47 48 47 50 51 50 53 54 55 54 57 58 59 58 61 62 61 64 65 66 65 68 69 68 71 72 73 72 75 76 77 76 79 80 79 82 83 82 85 86 87 86 89 90 91 90 93 94 95 94 97 98 97 100 101 ...

result:

ok correct

Test #25:

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

input:

888888888

output:

105
1 2 1 4 5 4 7 8 7 10 11 12 11 14 15 16 15 18 19 20 19 22 23 22 25 26 25 28 29 28 31 32 33 32 35 36 37 36 39 40 41 40 43 44 45 44 47 48 47 50 51 52 51 54 55 54 57 58 59 58 61 62 63 62 65 66 65 68 69 70 69 72 73 74 73 76 77 78 77 80 81 82 81 84 85 86 85 88 89 88 91 92 91 94 95 96 95 98 99 98 101 1...

result:

ok correct

Test #26:

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

input:

333333334

output:

100
1 2 1 4 5 6 5 8 9 10 9 12 13 12 15 16 17 16 19 20 19 22 23 24 23 26 27 26 29 30 31 30 33 34 35 34 37 38 37 40 41 40 43 44 43 46 47 46 49 50 51 50 53 54 53 56 57 56 59 60 61 60 63 64 65 64 67 68 69 68 71 72 73 72 75 76 75 78 79 80 79 82 83 84 83 86 87 88 87 90 91 92 91 94 95 94 97 98 97
100000000...

result:

ok correct

Test #27:

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

input:

83495645

output:

93
1 2 3 2 5 6 5 8 9 10 9 12 13 14 13 16 17 18 17 20 21 20 23 24 25 24 27 28 29 28 31 32 31 34 35 36 35 38 39 38 41 42 43 42 45 46 45 48 49 48 51 52 51 54 55 54 57 58 57 60 61 62 61 64 65 64 67 68 69 68 71 72 73 72 75 76 77 76 79 80 81 80 83 84 85 84 87 88 87 90 91 90
27 1000000000 1 1 1000000000 1 ...

result:

ok correct

Test #28:

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

input:

894567865

output:

101
1 2 3 2 5 6 5 8 9 8 11 12 13 12 15 16 17 16 19 20 21 20 23 24 23 26 27 28 27 30 31 32 31 34 35 34 37 38 39 38 41 42 41 44 45 44 47 48 47 50 51 50 53 54 53 56 57 56 59 60 61 60 63 64 63 66 67 66 69 70 71 70 73 74 73 76 77 78 77 80 81 80 83 84 85 84 87 88 87 90 91 92 91 94 95 94 97 98 99 98
30 100...

result:

ok correct

Test #29:

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

input:

88479456

output:

89
1 2 1 4 5 4 7 8 7 10 11 10 13 14 13 16 17 18 17 20 21 22 21 24 25 26 25 28 29 28 31 32 33 32 35 36 37 36 39 40 39 42 43 44 43 46 47 46 49 50 49 52 53 52 55 56 55 58 59 60 59 62 63 64 63 66 67 66 69 70 69 72 73 72 75 76 77 76 79 80 79 82 83 84 83 86 87 86
1000000000 1 1 1000000000 1 1 1000000000 1...

result:

ok correct

Test #30:

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

input:

1000000

output:

64
1 2 1 4 5 4 7 8 7 10 11 10 13 14 13 16 17 16 19 20 21 20 23 24 23 26 27 26 29 30 31 30 33 34 33 36 37 36 39 40 39 42 43 42 45 46 47 46 49 50 49 52 53 54 53 56 57 58 57 60 61 62 61
1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 1000000000 1 1 14 1000000000 1 1 100000000...

result:

ok correct

Test #31:

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

input:

429085001

output:

97
1 2 3 2 5 6 5 8 9 8 11 12 13 12 15 16 15 18 19 18 21 22 23 22 25 26 25 28 29 30 29 32 33 32 35 36 35 38 39 38 41 42 43 42 45 46 45 48 49 50 49 52 53 52 55 56 57 56 59 60 61 60 63 64 63 66 67 66 69 70 71 70 73 74 73 76 77 76 79 80 81 80 83 84 85 84 87 88 87 90 91 90 93 94 95 94
29 1000000000 1 1 1...

result:

ok correct

Test #32:

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

input:

882138811

output:

104
1 2 3 2 5 6 7 6 9 10 9 12 13 14 13 16 17 18 17 20 21 22 21 24 25 24 27 28 29 28 31 32 31 34 35 36 35 38 39 40 39 42 43 44 43 46 47 48 47 50 51 50 53 54 55 54 57 58 57 60 61 60 63 64 63 66 67 68 67 70 71 70 73 74 75 74 77 78 77 80 81 80 83 84 85 84 87 88 87 90 91 90 93 94 95 94 97 98 97 100 101 1...

result:

ok correct

Test #33:

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

input:

513157691

output:

100
1 2 3 2 5 6 7 6 9 10 9 12 13 14 13 16 17 18 17 20 21 22 21 24 25 24 27 28 27 30 31 30 33 34 35 34 37 38 37 40 41 42 41 44 45 44 47 48 49 48 51 52 51 54 55 54 57 58 57 60 61 62 61 64 65 66 65 68 69 68 71 72 73 72 75 76 75 78 79 78 81 82 83 82 85 86 85 88 89 90 89 92 93 94 93 96 97 98 97
29 100000...

result:

ok correct

Test #34:

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

input:

813900859

output:

99
1 2 3 2 5 6 7 6 9 10 9 12 13 14 13 16 17 18 17 20 21 22 21 24 25 24 27 28 27 30 31 30 33 34 33 36 37 38 37 40 41 40 43 44 43 46 47 48 47 50 51 50 53 54 53 56 57 58 57 60 61 62 61 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 81 80 83 84 83 86 87 86 89 90 89 92 93 92 95 96 97 96
30 1000000000...

result:

ok correct

Test #35:

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

input:

454848871

output:

100
1 2 3 2 5 6 7 6 9 10 11 10 13 14 13 16 17 16 19 20 21 20 23 24 25 24 27 28 27 30 31 32 31 34 35 34 37 38 37 40 41 40 43 44 45 44 47 48 49 48 51 52 53 52 55 56 55 58 59 58 61 62 61 64 65 66 65 68 69 70 69 72 73 74 73 76 77 76 79 80 79 82 83 82 85 86 87 86 89 90 91 90 93 94 93 96 97 98 97
29 10000...

result:

ok correct

Test #36:

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

input:

151401319

output:

94
1 2 3 2 5 6 7 6 9 10 11 10 13 14 13 16 17 16 19 20 21 20 23 24 25 24 27 28 27 30 31 32 31 34 35 36 35 38 39 38 41 42 41 44 45 46 45 48 49 50 49 52 53 52 55 56 55 58 59 58 61 62 63 62 65 66 67 66 69 70 69 72 73 72 75 76 75 78 79 78 81 82 81 84 85 86 85 88 89 88 91 92 91
28 1000000000 1 1 27 100000...

result:

ok correct

Test #37:

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

input:

280898521

output:

100
1 2 3 2 5 6 5 8 9 8 11 12 13 12 15 16 17 16 19 20 19 22 23 24 23 26 27 28 27 30 31 32 31 34 35 36 35 38 39 38 41 42 43 42 45 46 45 48 49 50 49 52 53 52 55 56 55 58 59 58 61 62 63 62 65 66 67 66 69 70 71 70 73 74 75 74 77 78 79 78 81 82 81 84 85 86 85 88 89 88 91 92 91 94 95 94 97 98 97
29 100000...

result:

ok correct

Test #38:

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

input:

412968047

output:

100
1 2 3 2 5 6 7 6 9 10 11 10 13 14 15 14 17 18 17 20 21 22 21 24 25 26 25 28 29 28 31 32 31 34 35 34 37 38 39 38 41 42 41 44 45 44 47 48 49 48 51 52 53 52 55 56 55 58 59 60 59 62 63 62 65 66 67 66 69 70 71 70 73 74 75 74 77 78 77 80 81 80 83 84 85 84 87 88 87 90 91 90 93 94 93 96 97 98 97
29 10000...

result:

ok correct

Extra Test:

score: 0
Extra Test Passed