QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#75129 | #5236. Wersja dla profesjonalistów [A] | wangzhe_0477 | 0 | 2ms | 3492kb | C++17 | 694b | 2023-02-04 15:43:20 | 2023-02-04 15:43:22 |
Judging History
answer
#include <bits/stdc++.h>
using LL = long long;
std::string F(std::string s, LL x) {
if (s.empty() || x == 0) return "";
else if (x < 10) return std::to_string(x) + "[" + s + "]";
else return "9[" + F(s, x / 9) + "]" + F(s, x % 9);
}
std::string Solve(LL n) {
if (n == 1) return "AE";
if (n & 1 ^ 1) return Solve(n - 1) + F("AC", n - 1) + "A" + F("E", n);
std::string s;
int mid = n / 2;
s += F(Solve(mid), 2);
s += F("AC", mid) + "A";
s += F(F("CE", mid + 1) + "C" + F("A", mid + 1), mid);
s += F("E", n);
return s;
}
int main() {
LL n;
std::cin >> n;
std::cout << Solve(n) + F("C", 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: 3304kb
input:
1
output:
AE1[C]
result:
ok correct (length = 3)
Test #2:
score: 0
Accepted
time: 2ms
memory: 3404kb
input:
2
output:
AE1[AC]A2[E]2[C]
result:
ok correct (length = 13)
Test #3:
score: -1
Wrong Answer
time: 1ms
memory: 3332kb
input:
4
output:
2[AE]1[AC]A1[2[CE]C2[A]]3[E]3[AC]A4[E]4[C]
result:
wrong answer incorrect path
Subtask #2:
score: 0
Wrong Answer
Test #16:
score: 0
Wrong Answer
time: 1ms
memory: 3340kb
input:
320
output:
2[2[2[2[2[2[2[AE]1[AC]A1[2[CE]C2[A]]3[E]3[AC]A4[E]]4[AC]A4[5[CE]C5[A]]9[E]]9[AC]A9[9[1[CE]]1[CE]C9[1[A]]1[A]]9[2[E]]1[E]]9[2[AC]]1[AC]A9[2[9[2[CE]]2[CE]C9[2[A]]2[A]]]1[9[2[CE]]2[CE]C9[2[A]]2[A]]9[4[E]]3[E]]9[4[AC]]3[AC]A9[4[9[4[CE]]4[CE]C9[4[A]]4[A]]]3[9[4[CE]]4[CE]C9[4[A]]4[A]]9[8[E]]7[E]]9[8[AC]]7...
result:
wrong answer incorrect path
Subtask #3:
score: 0
Wrong Answer
Test #28:
score: 0
Wrong Answer
time: 2ms
memory: 3364kb
input:
1000000
output:
2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[AE1[AC]A2[E]]2[AC]A2[3[CE]C3[A]]5[E]5[AC]A6[E]]6[AC]A6[7[CE]C7[A]]9[1[E]]4[E]9[1[AC]]4[AC]A9[1[E]]5[E]]9[1[AC]]5[AC]A9[1[9[1[CE]]6[CE]C9[1[A]]6[A]]]5[9[1[CE]]6[CE]C9[1[A]]6[A]]9[3[E]]2[E]]9[3[AC]]2[AC]A9[3[9[3[CE]]3[CE]C9[3[A]]3[A]]]2[9[3[CE]]3[CE]C9[3[A]]3[A]]9[6...
result:
wrong answer incorrect path
Subtask #4:
score: 0
Wrong Answer
Test #37:
score: 0
Wrong Answer
time: 2ms
memory: 3364kb
input:
999999
output:
2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[AE1[AC]A2[E]]2[AC]A2[3[CE]C3[A]]5[E]5[AC]A6[E]]6[AC]A6[7[CE]C7[A]]9[1[E]]4[E]9[1[AC]]4[AC]A9[1[E]]5[E]]9[1[AC]]5[AC]A9[1[9[1[CE]]6[CE]C9[1[A]]6[A]]]5[9[1[CE]]6[CE]C9[1[A]]6[A]]9[3[E]]2[E]]9[3[AC]]2[AC]A9[3[9[3[CE]]3[CE]C9[3[A]]3[A]]]2[9[3[CE]]3[CE]C9[3[A]]3[A]]9[6...
result:
wrong answer incorrect path
Subtask #5:
score: 0
Wrong Answer
Test #46:
score: 0
Wrong Answer
time: 2ms
memory: 3492kb
input:
10000000000
output:
2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[AE]1[AC]A1[2[CE]C2[A]]3[E]3[AC]A4[E]]4[AC]A4[5[CE]C5[A]]9[E]]9[AC]A9[9[1[CE]]1[CE]C9[1[A]]1[A]]9[2[E]]1[E]9[2[AC]]1[AC]A9[2[E]]2[E]]9[2[AC]]2[AC]A9[2[9[2[CE]]3[CE]C9[2[A]]3[A]]]2[9[2[CE]]3[CE]C9[2[A]]3[A]]9[4[E]]5[E]]9[4[AC]]5[AC]A9[4[9[4[CE]...
result:
wrong answer incorrect path
Subtask #6:
score: 0
Wrong Answer
Test #55:
score: 0
Wrong Answer
time: 1ms
memory: 3472kb
input:
9999999999
output:
2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[2[AE]1[AC]A1[2[CE]C2[A]]3[E]3[AC]A4[E]]4[AC]A4[5[CE]C5[A]]9[E]]9[AC]A9[9[1[CE]]1[CE]C9[1[A]]1[A]]9[2[E]]1[E]9[2[AC]]1[AC]A9[2[E]]2[E]]9[2[AC]]2[AC]A9[2[9[2[CE]]3[CE]C9[2[A]]3[A]]]2[9[2[CE]]3[CE]C9[2[A]]3[A]]9[4[E]]5[E]]9[4[AC]]5[AC]A9[4[9[4[CE]...
result:
wrong answer incorrect path
Subtask #7:
score: 0
Memory Limit Exceeded
Test #64:
score: 0
Memory Limit Exceeded
input:
100000000000000
output:
result:
Subtask #8:
score: 0
Memory Limit Exceeded
Test #84:
score: 0
Memory Limit Exceeded
input:
99999999999999
output:
result:
Subtask #9:
score: 0
Memory Limit Exceeded
Test #103:
score: 0
Memory Limit Exceeded
input:
1000000000000000000
output:
result:
Subtask #10:
score: 0
Memory Limit Exceeded
Test #128:
score: 0
Memory Limit Exceeded
input:
999999999999999999