QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#84108 | #5671. Programmable Virus | maspy | AC ✓ | 17ms | 8044kb | Python3 | 1019b | 2023-03-05 15:31:01 | 2023-03-05 15:31:02 |
Judging History
answer
words = {
'0': "CCC",
'>': "ACG",
'<': "UGA",
'+': "UGC",
'-': "UAC",
'.': "GCG",
',': "UCC",
'[': "AGG",
']': "UGU",
'9': "CAC"
}
def convert(S):
return "".join(words[x] for x in S)
def solve(p):
# divmod
X = ">" + ("+" * p) + "<[>->+<[>]>[<+>-]<<[<]>-]>[-]>[-<<+>>]<<"
# B は、[1,>x,y] のときに [1,>10x+y] にする
# B = C + D + E
# C は、[1,>x,y,0,0] のときに [1,>0,y,0,10x] にする
# D は [1,>0,y,0,10x] のときに [1,>0,0,0,10x+y] にする
E = ">>>[-<<<+>>>]<<<"
D = ">[->>+" + X + "<<]<"
C = "[->>>" + 10 * ("+" + X) + "<<<]"
B = C + D + E
# ANS = f"+[>{A}<]"
# [1,>x] のときに、[1,>10x+y] にするのが A
# [1,x,>y,1] にしたあと、y=0 以外はポインタをずらす
A = ">,9>+<+" + "[>>]>[<<[[-].0]+.0]" + "<<-<-<" + B
ANS = f"+[9>{A}<]"
ANS = ANS.replace("9", "")
return convert(ANS)
n = int(input())
print(solve(n))
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 11ms
memory: 7964kb
input:
1
output:
UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACG...
result:
ok correct
Test #2:
score: 0
Accepted
time: 7ms
memory: 8044kb
input:
2
output:
UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGA...
result:
ok correct
Test #3:
score: 0
Accepted
time: 3ms
memory: 7976kb
input:
3
output:
UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACG...
result:
ok correct
Test #4:
score: 0
Accepted
time: 5ms
memory: 7972kb
input:
6
output:
UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGCUGCUGCUGAAGGACGUACACG...
result:
ok correct
Test #5:
score: 0
Accepted
time: 11ms
memory: 7968kb
input:
1
output:
UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACG...
result:
ok correct
Test #6:
score: 0
Accepted
time: 10ms
memory: 8000kb
input:
2
output:
UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGA...
result:
ok correct
Test #7:
score: 0
Accepted
time: 12ms
memory: 7952kb
input:
3
output:
UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACG...
result:
ok correct
Test #8:
score: 0
Accepted
time: 11ms
memory: 7968kb
input:
4
output:
UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACG...
result:
ok correct
Test #9:
score: 0
Accepted
time: 13ms
memory: 7972kb
input:
5
output:
UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGCUGCUGAAGGACGUACACGUGCUGA...
result:
ok correct
Test #10:
score: 0
Accepted
time: 17ms
memory: 8004kb
input:
6
output:
UGCAGGACGACGUCCACGUGCUGAUGCAGGACGACGUGUACGAGGUGAUGAAGGAGGUACUGUGCGCCCUGUUGCGCGCCCUGUUGAUGAUACUGAUACUGAAGGUACACGACGACGUGCACGUGCUGCUGCUGCUGCUGCUGAAGGACGUACACGUGCUGAAGGACGUGUACGAGGUGAUGCACGUACUGUUGAUGAAGGUGAUGUACGUACUGUACGAGGUACUGUACGAGGUACUGAUGAUGCACGACGUGUUGAUGAUGCACGUGCUGCUGCUGCUGCUGCUGAAGGACGUACACG...
result:
ok correct