QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#820310#9852. Divisionstselmegkh#WA 0ms3672kbC++14951b2024-12-18 20:54:142024-12-18 20:54:15

Judging History

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

  • [2024-12-18 20:54:15]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3672kb
  • [2024-12-18 20:54:14]
  • 提交

answer

#include<iostream>
using namespace std;


void solve() {
    int k;
    cin >> k;
    if (k == 0) {
        cout << "6\n" << "3 1 4 2 5 4\n";
        return;
    }
    if (k == 1) {
        cout << "6\n" << "1 1 4 5 1 4\n";
        return;
    }

    int tmp = k;
    int cnt = 0;
    while (tmp != 1) {
        if (tmp % 2 == 0) {
            cnt++;
            tmp /= 2;
        }
        else break;
    }
    if (tmp == 1) {
        cout << cnt << '\n';
        for (int i = 0; i < cnt; i++) {
            cout << 1 << " \n"[i == cnt - 1];
        }
        return;
    }
    if (k <= 366) {
        cout << k - 1 << '\n';
        for (int i = 1; i <= k - 1; i++) {
            cout << i << " \n"[i == k - 1];
        }
        return;
    }
    cout << "-1\n";
}

int main() {
    ios::sync_with_stdio(0);cin.tie(nullptr);
    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }
}

詳細信息

Test #1:

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

input:

1

output:

6
1 1 4 5 1 4

result:

ok correct

Test #2:

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

input:

2

output:

1
1

result:

ok correct

Test #3:

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

input:

0

output:

6
3 1 4 2 5 4

result:

ok correct

Test #4:

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

input:

3

output:

2
1 2

result:

ok correct

Test #5:

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

input:

4

output:

2
1 1

result:

ok correct

Test #6:

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

input:

5

output:

4
1 2 3 4

result:

ok correct

Test #7:

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

input:

6

output:

5
1 2 3 4 5

result:

ok correct

Test #8:

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

input:

7

output:

6
1 2 3 4 5 6

result:

ok correct

Test #9:

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

input:

8

output:

3
1 1 1

result:

ok correct

Test #10:

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

input:

9

output:

8
1 2 3 4 5 6 7 8

result:

ok correct

Test #11:

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

input:

10

output:

9
1 2 3 4 5 6 7 8 9

result:

ok correct

Test #12:

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

input:

11

output:

10
1 2 3 4 5 6 7 8 9 10

result:

ok correct

Test #13:

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

input:

12

output:

11
1 2 3 4 5 6 7 8 9 10 11

result:

ok correct

Test #14:

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

input:

13

output:

12
1 2 3 4 5 6 7 8 9 10 11 12

result:

ok correct

Test #15:

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

input:

14

output:

13
1 2 3 4 5 6 7 8 9 10 11 12 13

result:

ok correct

Test #16:

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

input:

15

output:

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

result:

ok correct

Test #17:

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

input:

16

output:

4
1 1 1 1

result:

ok correct

Test #18:

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

input:

24

output:

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

result:

ok correct

Test #19:

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

input:

31

output:

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

result:

ok correct

Test #20:

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

input:

32

output:

5
1 1 1 1 1

result:

ok correct

Test #21:

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

input:

63

output:

62
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

result:

ok correct

Test #22:

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

input:

64

output:

6
1 1 1 1 1 1

result:

ok correct

Test #23:

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

input:

127

output:

126
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok correct

Test #24:

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

input:

128

output:

7
1 1 1 1 1 1 1

result:

ok correct

Test #25:

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

input:

255

output:

254
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 ...

result:

ok correct

Test #26:

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

input:

256

output:

8
1 1 1 1 1 1 1 1

result:

ok correct

Test #27:

score: -100
Wrong Answer
time: 0ms
memory: 3552kb

input:

511

output:

-1

result:

wrong answer jury has answer but participant not