QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#75177#5236. Wersja dla profesjonalistów [A]stkwill0 2ms3756kbC++141.0kb2023-02-04 16:15:052023-02-04 16:15:07

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-04 16:15:07]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:3756kb
  • [2023-02-04 16:15:05]
  • 提交

answer

#include <bits/stdc++.h>

using int64 = long long;

const int N = 200005;

inline std::string Str(int64 n, std::string s) {
    if (n == 0) return std::string();
    if (n == 1) return s;
    if (n <= 9) return std::string(1, char('0' + n)) + "[" + s + "]";
    return "9[" + Str(n / 9, s) + "]" + Str(n % 9, s);
}

inline void Put(int64 n, std::string s) { printf("%s", Str(n, s).data()); }

inline void Solve(int64 n) {
    // std::cerr << "Solve(" << n << ")" << std::endl;
    if (n == 1) return void(printf("AE"));
    if (n == 2) return void(printf("AAECEAE"));
    if (!(n & 1)) return Put(n, "A"), Put(n - 1, "EC"), printf("E"), Solve(n - 1);
    int k = n / 2;
    printf("2["), Solve(k), printf("]");
    Put(k, "AC"), printf("A");
    Put(k, Str(k, "CE") + "C" + Str(k + 1, "A"));
    Put(n, "E");
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr), std::cout.tie(nullptr);
    int64 n;
    std::cin >> n;
    Solve(n), printf("%lld[C]\n", n);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 1
Accepted
time: 2ms
memory: 3696kb

input:

1

output:

AE1[C]

result:

ok correct (length = 3)

Test #2:

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

input:

2

output:

AAECEAE2[C]

result:

ok correct (length = 13)

Test #3:

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

input:

4

output:

4[A]3[EC]E2[AE]ACACEC2[A]3[E]4[C]

result:

ok correct (length = 30)

Test #4:

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

input:

5

output:

2[AAECEAE]2[AC]A2[2[CE]C3[A]]5[E]5[C]

result:

ok correct (length = 43)

Test #5:

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

input:

6

output:

6[A]5[EC]E2[AAECEAE]2[AC]A2[2[CE]C3[A]]5[E]6[C]

result:

ok correct (length = 53)

Test #6:

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

input:

7

output:

2[2[AE]ACACEC2[A]3[E]]3[AC]A3[3[CE]C4[A]]7[E]7[C]

result:

ok correct (length = 53)

Test #7:

score: -1
Wrong Answer
time: 2ms
memory: 3564kb

input:

10

output:

9[A]A9[EC]E2[4[A]3[EC]E2[AE]ACACEC2[A]3[E]]4[AC]A4[4[CE]C5[A]]9[E]10[C]

result:

wrong answer invalid output

Subtask #2:

score: 0
Wrong Answer

Test #16:

score: 0
Wrong Answer
time: 2ms
memory: 3584kb

input:

320

output:

9[9[3[A]]8[A]]5[A]9[9[3[EC]]8[EC]]4[EC]E2[2[2[2[2[2[4[A]3[EC]E2[AE]ACACEC2[A]3[E]]4[AC]A4[4[CE]C5[A]]9[E]]9[AC]A9[9[CE]C9[A]A]9[2[E]]E]9[2[AC]]ACA9[2[9[2[CE]]CEC9[2[A]]2[A]]]9[2[CE]]CEC9[2[A]]2[A]9[4[E]]3[E]]9[4[AC]]3[AC]A9[4[9[4[CE]]3[CE]C9[4[A]]4[A]]]3[9[4[CE]]3[CE]C9[4[A]]4[A]]9[8[E]]7[E]]9[8[AC]...

result:

wrong answer invalid output

Subtask #3:

score: 0
Wrong Answer

Test #28:

score: 0
Wrong Answer
time: 0ms
memory: 3592kb

input:

1000000

output:

9[9[9[9[9[9[A]7[A]]8[A]]3[A]]6[A]]6[A]]A9[9[9[9[9[9[EC]7[EC]]8[EC]]3[EC]]6[EC]]6[EC]]E2[2[2[2[2[2[9[9[9[9[2[A]]3[A]]3[A]]8[A]]9[9[9[9[2[EC]]3[EC]]3[EC]]7[EC]]8[EC]E2[2[2[9[9[9[2[A]]6[A]]]8[A]9[9[9[2[EC]]6[EC]]]7[EC]E2[2[2[2[2[9[6[A]]6[A]9[6[EC]]5[EC]E2[2[9[A]5[A]9[EC]4[EC]E2[6[A]5[EC]E2[AAECEAE]2[AC...

result:

wrong answer invalid output

Subtask #4:

score: 0
Wrong Answer

Test #37:

score: 0
Wrong Answer
time: 2ms
memory: 3716kb

input:

999999

output:

2[2[2[2[2[2[9[9[9[9[2[A]]3[A]]3[A]]8[A]]9[9[9[9[2[EC]]3[EC]]3[EC]]7[EC]]8[EC]E2[2[2[9[9[9[2[A]]6[A]]]8[A]9[9[9[2[EC]]6[EC]]]7[EC]E2[2[2[2[2[9[6[A]]6[A]9[6[EC]]5[EC]E2[2[9[A]5[A]9[EC]4[EC]E2[6[A]5[EC]E2[AAECEAE]2[AC]A2[2[CE]C3[A]]5[E]]6[AC]A6[6[CE]C7[A]]9[E]4[E]]9[AC]5[AC]A9[9[CE]5[CE]C9[A]6[A]]5[9[C...

result:

wrong answer invalid output

Subtask #5:

score: 0
Wrong Answer

Test #46:

score: 0
Wrong Answer
time: 2ms
memory: 3608kb

input:

10000000000

output:

9[9[9[9[9[9[9[9[9[9[2[A]]7[A]]7[A]]2[A]]6[A]]6[A]]7[A]]8[A]]A]A]A9[9[9[9[9[9[9[9[9[9[2[EC]]7[EC]]7[EC]]2[EC]]6[EC]]6[EC]]7[EC]]8[EC]]EC]EC]E2[2[2[2[2[2[2[2[2[2[9[9[9[9[9[9[2[A]]5[A]]2[A]]7[A]]8[A]]A]7[A]9[9[9[9[9[9[2[EC]]5[EC]]2[EC]]7[EC]]8[EC]]EC]6[EC]E2[2[2[9[9[9[9[9[2[A]]8[A]]2[A]]A]]A9[9[9[9[9[2...

result:

wrong answer invalid output

Subtask #6:

score: 0
Wrong Answer

Test #55:

score: 0
Wrong Answer
time: 0ms
memory: 3632kb

input:

9999999999

output:

2[2[2[2[2[2[2[2[2[2[9[9[9[9[9[9[2[A]]5[A]]2[A]]7[A]]8[A]]A]7[A]9[9[9[9[9[9[2[EC]]5[EC]]2[EC]]7[EC]]8[EC]]EC]6[EC]E2[2[2[9[9[9[9[9[2[A]]8[A]]2[A]]A]]A9[9[9[9[9[2[EC]]8[EC]]2[EC]]EC]]E2[9[9[9[9[9[A]4[A]]A]]4[A]]4[A]9[9[9[9[9[EC]4[EC]]EC]]4[EC]]3[EC]E2[9[9[9[9[6[A]]5[A]]]2[A]]A9[9[9[9[6[EC]]5[EC]]]2[EC...

result:

wrong answer invalid output

Subtask #7:

score: 0
Memory Limit Exceeded

Test #64:

score: 0
Memory Limit Exceeded

input:

100000000000000

output:

9[9[9[9[9[9[9[9[9[9[9[9[9[9[4[A]]3[A]]3[A]]]5[A]]6[A]]4[A]]2[A]]7[A]]2[A]]7[A]]5[A]]2[A]]5[A]]A9[9[9[9[9[9[9[9[9[9[9[9[9[9[4[EC]]3[EC]]3[EC]]]5[EC]]6[EC]]4[EC]]2[EC]]7[EC]]2[EC]]7[EC]]5[EC]]2[EC]]5[EC]]E2[2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[

result:


Subtask #8:

score: 0
Memory Limit Exceeded

Test #84:

score: 0
Memory Limit Exceeded

input:

99999999999999

output:

2[2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[

result:


Subtask #9:

score: 0
Memory Limit Exceeded

Test #103:

score: 0
Memory Limit Exceeded

input:

1000000000000000000

output:

9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[6[A]]5[A]]8[A]]5[A]]8[A]]3[A]]7[A]]A]4[A]]]6[A]]3[A]]6[A]]8[A]]2[A]]5[A]]2[A]]]A9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[9[6[EC]]5[EC]]8[EC]]5[EC]]8[EC]]3[EC]]7[EC]]EC]4[EC]]]6[EC]]3[EC]]6[EC]]8[EC]]2[EC]]5[EC]]2[EC]]]E2[2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[...

result:


Subtask #10:

score: 0
Memory Limit Exceeded

Test #128:

score: 0
Memory Limit Exceeded

input:

999999999999999999

output:

2[2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[0[A]/[EC]E2[

result: