QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#356664#8300. Game Designkevinyang#AC ✓1ms4648kbC++171.0kb2024-03-18 07:24:312024-03-18 07:24:32

Judging History

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

  • [2024-03-18 07:24:32]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:4648kb
  • [2024-03-18 07:24:31]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mxn = 100005;
vector<int>parent(mxn);
vector<int>cost(mxn);
vector<int>nodes;
int cur = 0;
void dfs(int u, int p, int v, int c){
    parent[u] = p;
    cost[u] = c;
    nodes.push_back(u);
    v--;
    if(v==0){
        return;
    }
    if(v%2==0 && v>=4){
        cur++;
        dfs(cur,u,2,1);
        cur++;
        dfs(cur,u,v/2,c-1);
        return;
    }
    cur++;
    dfs(cur,u,v,c);
}
signed main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    int k;
    cin >> k;
    if(k==1){
        cout << "2\n";
        cout << "1\n";
        cout << "2 1\n";
        return 0;
    }
    cur = 1;
    dfs(1,0,k,(int)1e9);
    int n = nodes.size();
    cout << n << '\n';
    for(int i = 2; i<=n; i++){
        cout << parent[i];
        if(i<n)cout << ' ';
    }
    cout << '\n';
    for(int i = 1; i<=n; i++){
        cout << cost[i];
        if(i<n)cout << ' ';
    }
    cout << '\n';
    return 0;
}

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2

output:

2
1
1000000000 1000000000

result:

ok correct

Test #2:

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

input:

1

output:

2
1
2 1

result:

ok correct

Test #3:

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

input:

3

output:

3
1 2
1000000000 1000000000 1000000000

result:

ok correct

Test #4:

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

input:

4

output:

4
1 2 3
1000000000 1000000000 1000000000 1000000000

result:

ok correct

Test #5:

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

input:

5

output:

5
1 2 1 4
1000000000 1 1 999999999 999999999

result:

ok correct

Test #6:

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

input:

6

output:

6
1 2 3 2 5
1000000000 1000000000 1 1 999999999 999999999

result:

ok correct

Test #7:

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

input:

7

output:

6
1 2 1 4 5
1000000000 1 1 999999999 999999999 999999999

result:

ok correct

Test #8:

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

input:

8

output:

7
1 2 3 2 5 6
1000000000 1000000000 1 1 999999999 999999999 999999999

result:

ok correct

Test #9:

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

input:

9

output:

7
1 2 1 4 5 6
1000000000 1 1 999999999 999999999 999999999 999999999

result:

ok correct

Test #10:

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

input:

11

output:

8
1 2 1 4 5 4 7
1000000000 1 1 999999999 1 1 999999998 999999998

result:

ok correct

Test #11:

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

input:

23

output:

11
1 2 1 4 5 4 7 8 7 10
1000000000 1 1 999999999 1 1 999999998 1 1 999999997 999999997

result:

ok correct

Test #12:

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

input:

64

output:

16
1 2 3 2 5 6 5 8 9 8 11 12 11 14 15
1000000000 1000000000 1 1 999999999 1 1 999999998 1 1 999999997 1 1 999999996 999999996 999999996

result:

ok correct

Test #13:

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

input:

87

output:

17
1 2 1 4 5 4 7 8 7 10 11 12 11 14 15 16
1000000000 1 1 999999999 1 1 999999998 1 1 999999997 999999997 1 1 999999996 999999996 999999996 999999996

result:

ok correct

Test #14:

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

input:

103

output:

18
1 2 1 4 5 4 7 8 7 10 11 12 11 14 15 14 17
1000000000 1 1 999999999 1 1 999999998 1 1 999999997 999999997 1 1 999999996 1 1 999999995 999999995

result:

ok correct

Test #15:

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

input:

128

output:

19
1 2 3 2 5 6 5 8 9 8 11 12 11 14 15 14 17 18
1000000000 1000000000 1 1 999999999 1 1 999999998 1 1 999999997 1 1 999999996 1 1 999999995 999999995 999999995

result:

ok correct

Test #16:

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

input:

325

output:

24
1 2 1 4 5 6 5 8 9 10 9 12 13 12 15 16 15 18 19 18 21 22 23
1000000000 1 1 999999999 999999999 1 1 999999998 999999998 1 1 999999997 1 1 999999996 1 1 999999995 1 1 999999994 999999994 999999994 999999994

result:

ok correct

Test #17:

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

input:

567

output:

27
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
1000000000 1 1 999999999 1 1 999999998 1 1 999999997 999999997 1 1 999999996 999999996 1 1 999999995 999999995 1 1 999999994 1 1 999999993 999999993 999999993

result:

ok correct

Test #18:

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

input:

9999

output:

40
1 2 1 4 5 4 7 8 7 10 11 10 13 14 15 14 17 18 17 20 21 20 23 24 23 26 27 28 27 30 31 32 31 34 35 36 35 38 39
1000000000 1 1 999999999 1 1 999999998 1 1 999999997 1 1 999999996 999999996 1 1 999999995 1 1 999999994 1 1 999999993 1 1 999999992 999999992 1 1 999999991 999999991 1 1 999999990 99999999...

result:

ok correct

Test #19:

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

input:

93256

output:

52
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 28 31 32 31 34 35 36 35 38 39 40 39 42 43 42 45 46 47 46 49 50 51
1000000000 1000000000 1 1 999999999 1 1 999999998 1 1 999999997 999999997 1 1 999999996 1 1 999999995 1 1 999999994 999999994 1 1 999999993 1 1 999999992 ...

result:

ok correct

Test #20:

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

input:

3532462

output:

75
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 24 27 28 29 28 31 32 31 34 35 36 35 38 39 40 39 42 43 42 45 46 45 48 49 50 49 52 53 54 53 56 57 58 57 60 61 62 61 64 65 64 67 68 69 68 71 72 71 74
1000000000 1000000000 1 1 999999999 999999999 1 1 999999998 999999998 1 1 999999997 ...

result:

ok correct

Test #21:

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

input:

54389236

output:

90
1 2 3 2 5 6 5 8 9 10 9 12 13 12 15 16 17 16 19 20 21 20 23 24 25 24 27 28 29 28 31 32 33 32 35 36 35 38 39 38 41 42 43 42 45 46 45 48 49 50 49 52 53 54 53 56 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 83 86 87 86 89
1000000000 1000000000 1 1 999999999 1 1 ...

result:

ok correct

Test #22:

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

input:

93453967

output:

88
1 2 1 4 5 4 7 8 7 10 11 10 13 14 15 14 17 18 17 20 21 20 23 24 25 24 27 28 27 30 31 32 31 34 35 36 35 38 39 40 39 42 43 44 43 46 47 48 47 50 51 52 51 54 55 56 55 58 59 60 59 62 63 62 65 66 65 68 69 68 71 72 73 72 75 76 75 78 79 78 81 82 83 82 85 86 87
1000000000 1 1 999999999 1 1 999999998 1 1 99...

result:

ok correct

Test #23:

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

input:

1000000000

output:

98
1 2 3 2 5 6 5 8 9 8 11 12 11 14 15 14 17 18 17 20 21 20 23 24 23 26 27 26 29 30 31 30 33 34 33 36 37 38 37 40 41 40 43 44 43 46 47 48 47 50 51 52 51 54 55 54 57 58 59 58 61 62 61 64 65 66 65 68 69 70 69 72 73 72 75 76 75 78 79 80 79 82 83 84 83 86 87 88 87 90 91 90 93 94 95 94 97
1000000000 10000...

result:

ok correct

Test #24:

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

input:

999999999

output:

97
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
1000000000 1 1 999...

result:

ok correct

Test #25:

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

input:

888888888

output:

103
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 26 29 30 29 32 33 34 33 36 37 38 37 40 41 42 41 44 45 46 45 48 49 48 51 52 53 52 55 56 55 58 59 60 59 62 63 64 63 66 67 66 69 70 71 70 73 74 75 74 77 78 79 78 81 82 83 82 85 86 87 86 89 90 89 92 93 92 95 96 97 96 99 100 99 10...

result:

ok correct

Test #26:

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

input:

333333334

output:

97
1 2 3 2 5 6 7 6 9 10 11 10 13 14 13 16 17 18 17 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 44 47 48 47 50 51 52 51 54 55 54 57 58 57 60 61 62 61 64 65 66 65 68 69 70 69 72 73 74 73 76 77 76 79 80 81 80 83 84 85 84 87 88 89 88 91 92 93 92 95 96
1000000000 1000000...

result:

ok correct

Test #27:

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

input:

83495645

output:

89
1 2 1 4 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
1000000000 1 1 999999999 999999999 1 1 9999...

result:

ok correct

Test #28:

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

input:

894567865

output:

98
1 2 1 4 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
1000000000 1 1 9...

result:

ok correct

Test #29:

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

input:

88479456

output:

86
1 2 3 2 5 6 5 8 9 8 11 12 11 14 15 14 17 18 19 18 21 22 23 22 25 26 27 26 29 30 29 32 33 34 33 36 37 38 37 40 41 40 43 44 45 44 47 48 47 50 51 50 53 54 53 56 57 56 59 60 61 60 63 64 65 64 67 68 67 70 71 70 73 74 73 76 77 78 77 80 81 80 83 84 85
1000000000 1000000000 1 1 999999999 1 1 999999998 1 ...

result:

ok correct

Test #30:

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

input:

1000000

output:

62
1 2 3 2 5 6 5 8 9 8 11 12 11 14 15 14 17 18 17 20 21 22 21 24 25 24 27 28 27 30 31 32 31 34 35 34 37 38 37 40 41 40 43 44 43 46 47 48 47 50 51 50 53 54 55 54 57 58 59 58 61
1000000000 1000000000 1 1 999999999 1 1 999999998 1 1 999999997 1 1 999999996 1 1 999999995 1 1 999999994 999999994 1 1 9999...

result:

ok correct

Test #31:

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

input:

429085001

output:

94
1 2 1 4 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
1000000000 1 1 999999999 999...

result:

ok correct

Test #32:

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

input:

882138811

output:

100
1 2 1 4 5 4 7 8 9 8 11 12 13 12 15 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 43 42 45 46 47 46 49 50 49 52 53 54 53 56 57 56 59 60 59 62 63 62 65 66 67 66 69 70 69 72 73 74 73 76 77 76 79 80 79 82 83 84 83 86 87 86 89 90 89 92 93 94 93 96 97 96 99
100000000...

result:

ok correct

Test #33:

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

input:

513157691

output:

96
1 2 1 4 5 4 7 8 9 8 11 12 13 12 15 16 17 16 19 20 21 20 23 24 23 26 27 26 29 30 29 32 33 34 33 36 37 36 39 40 41 40 43 44 43 46 47 48 47 50 51 50 53 54 53 56 57 56 59 60 61 60 63 64 65 64 67 68 67 70 71 72 71 74 75 74 77 78 77 80 81 82 81 84 85 84 87 88 89 88 91 92 93 92 95
1000000000 1 1 9999999...

result:

ok correct

Test #34:

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

input:

813900859

output:

95
1 2 1 4 5 4 7 8 9 8 11 12 13 12 15 16 17 16 19 20 21 20 23 24 23 26 27 26 29 30 29 32 33 32 35 36 37 36 39 40 39 42 43 42 45 46 47 46 49 50 49 52 53 52 55 56 57 56 59 60 61 60 63 64 63 66 67 66 69 70 69 72 73 72 75 76 75 78 79 80 79 82 83 82 85 86 85 88 89 88 91 92 91 94
1000000000 1 1 999999999 ...

result:

ok correct

Test #35:

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

input:

454848871

output:

95
1 2 1 4 5 4 7 8 7 10 11 12 11 14 15 14 17 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 47 46 49 50 51 50 53 54 53 56 57 56 59 60 59 62 63 64 63 66 67 68 67 70 71 72 71 74 75 74 77 78 77 80 81 80 83 84 85 84 87 88 89 88 91 92 91 94
1000000000 1 1 999999999...

result:

ok correct

Test #36:

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

input:

151401319

output:

88
1 2 1 4 5 4 7 8 7 10 11 12 11 14 15 14 17 18 19 18 21 22 23 22 25 26 25 28 29 30 29 32 33 34 33 36 37 36 39 40 39 42 43 44 43 46 47 48 47 50 51 50 53 54 53 56 57 56 59 60 61 60 63 64 65 64 67 68 67 70 71 70 73 74 73 76 77 76 79 80 79 82 83 84 83 86 87
1000000000 1 1 999999999 1 1 999999998 1 1 99...

result:

ok correct

Test #37:

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

input:

280898521

output:

96
1 2 1 4 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
1000000000 1 1 9999999...

result:

ok correct

Test #38:

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

input:

412968047

output:

94
1 2 1 4 5 4 7 8 7 10 11 10 13 14 15 14 17 18 19 18 21 22 23 22 25 26 25 28 29 28 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 57 56 59 60 59 62 63 64 63 66 67 68 67 70 71 72 71 74 75 74 77 78 77 80 81 82 81 84 85 84 87 88 87 90 91 90 93
1000000000 1 1 999999999 1 ...

result:

ok correct

Extra Test:

score: 0
Extra Test Passed