QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#363628 | #7692. Prof. Fumblemore and the Collatz Conjecture | lucasrpatten# | AC ✓ | 11ms | 9944kb | Python3 | 623b | 2024-03-24 01:11:04 | 2024-03-24 01:11:06 |
Judging History
answer
S=input()
v=True
if S[-1]!='O':
v=False
for i in range(len(S)-1):
if S[i]!='O' and S[i]!='E':
v=False
if S[i]=='O' and S[i+1]=='O':
v=False
if not v:
print('INVALID')
exit()
ans=16
S=S[::-1]
t=0
while True:
t=ans
found=True
for c in S:
if c=='E':
t*=2
if c=='O':
if t%3!=1:
ans*=2
found=False
break
t=(t-1)//3
if t%2!=1:
ans*=2
found=False
break
if found:
break
print(t)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 11ms
memory: 9844kb
input:
EEOEO
output:
12
result:
ok single line: '12'
Test #2:
score: 0
Accepted
time: 11ms
memory: 9780kb
input:
EEOOEO
output:
INVALID
result:
ok single line: 'INVALID'
Test #3:
score: 0
Accepted
time: 11ms
memory: 9824kb
input:
OEOEOEOEOEOEOEEEEEEOEEEOEEEOEEEOEOEEOEEEO
output:
383
result:
ok single line: '383'
Test #4:
score: 0
Accepted
time: 9ms
memory: 9812kb
input:
OEOEEEEEOEOEEEEOEEEEOEOEOEEOEEEO
output:
931
result:
ok single line: '931'
Test #5:
score: 0
Accepted
time: 10ms
memory: 9808kb
input:
OEEOEEOEEOEOEOEOEEEEEEOEOEEOEEOEEEEOEOEOEEOEEEO
output:
641
result:
ok single line: '641'
Test #6:
score: 0
Accepted
time: 10ms
memory: 9720kb
input:
OEOEEOEEOEEOEEOEEEEOEEEOEOEOEEEEEO
output:
683
result:
ok single line: '683'
Test #7:
score: 0
Accepted
time: 3ms
memory: 9844kb
input:
OEEOEEEOEOEEEEOEEEEOEOEOEEOEEEO
output:
465
result:
ok single line: '465'
Test #8:
score: 0
Accepted
time: 10ms
memory: 9916kb
input:
OEEOEEOEOEOEOEEEEEEOEOEEOEEOEEEEOEOEOEEOEEEO
output:
481
result:
ok single line: '481'
Test #9:
score: 0
Accepted
time: 10ms
memory: 9780kb
input:
OEEOEOEO
output:
201
result:
ok single line: '201'
Test #10:
score: 0
Accepted
time: 10ms
memory: 9720kb
input:
OEEEEOEEOEOEEEOEOEEOEEEO
output:
133
result:
ok single line: '133'
Test #11:
score: 0
Accepted
time: 10ms
memory: 9904kb
input:
OEOEOEOEEOEEEEEEEEEEOEOEOEEOEEEO
output:
943
result:
ok single line: '943'
Test #12:
score: 0
Accepted
time: 10ms
memory: 9844kb
input:
OEEEOEEO
output:
301
result:
ok single line: '301'
Test #13:
score: 0
Accepted
time: 2ms
memory: 9944kb
input:
OEOEOEEEEEEOEOEEOEEOEEEEOEOEOEEOEEEO
output:
407
result:
ok single line: '407'
Test #14:
score: 0
Accepted
time: 6ms
memory: 9808kb
input:
OEOEOEOEOEOEEOEEEEOEEEOEEEOEEEOEOEEOEEEO
output:
191
result:
ok single line: '191'
Test #15:
score: 0
Accepted
time: 10ms
memory: 9844kb
input:
OEEEOEO
output:
605
result:
ok single line: '605'
Test #16:
score: 0
Accepted
time: 9ms
memory: 9840kb
input:
OEOEOEOEEOEEEEOEEEOEEEOEEEOEOEEOEEEO
output:
431
result:
ok single line: '431'
Test #17:
score: 0
Accepted
time: 2ms
memory: 9840kb
input:
OEOEEEOEEEOEOEOEEEOEEEEOEOEEEOEOEEOEEEO
output:
563
result:
ok single line: '563'
Test #18:
score: 0
Accepted
time: 11ms
memory: 9808kb
input:
OEEOEEEEEOEEOEEEO
output:
241
result:
ok single line: '241'
Test #19:
score: 0
Accepted
time: 7ms
memory: 9808kb
input:
OEEEOEEEEOEOEEEOEOEEOEEEO
output:
269
result:
ok single line: '269'
Test #20:
score: 0
Accepted
time: 10ms
memory: 9724kb
input:
EEOEOEOEEOEEEEOEOEEOEEOEEEEOEOEOEEOEEEO
output:
540
result:
ok single line: '540'
Test #21:
score: 0
Accepted
time: 8ms
memory: 9940kb
input:
OEOEOEOEOEOEEEEEEOEEEOEEEOEEEOEOEEOEEEO
output:
575
result:
ok single line: '575'
Test #22:
score: 0
Accepted
time: 7ms
memory: 9812kb
input:
EEOEEOEOEEEEEOEOEOEEEEEO
output:
868
result:
ok single line: '868'
Test #23:
score: 0
Accepted
time: 5ms
memory: 9812kb
input:
OEOEOEO
output:
26512143
result:
ok single line: '26512143'
Test #24:
score: 0
Accepted
time: 7ms
memory: 9780kb
input:
OEOEOEEO
output:
13256071
result:
ok single line: '13256071'
Test #25:
score: 0
Accepted
time: 7ms
memory: 9832kb
input:
EEO
output:
20
result:
ok single line: '20'
Test #26:
score: 0
Accepted
time: 10ms
memory: 9804kb
input:
EOEOEOEOEOEOEOEOEOEOEOEOEOEOEOEOEOEOEOEOEOEOEOEOEE
output:
INVALID
result:
ok single line: 'INVALID'
Test #27:
score: 0
Accepted
time: 11ms
memory: 9812kb
input:
EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEO
output:
43980465111040
result:
ok single line: '43980465111040'
Test #28:
score: 0
Accepted
time: 10ms
memory: 9736kb
input:
EEEEEEEEEEOEEEOEEEEOEOEEOEEEEEOEEEEEEEOEEOEEEEEEEO
output:
7321693729792
result:
ok single line: '7321693729792'
Test #29:
score: 0
Accepted
time: 10ms
memory: 9772kb
input:
EEEOEEEOEEOEEEEEOEEEEEEEOEEEEEEEEEEEEEEEEOEEEEEO
output:
1028529777000
result:
ok single line: '1028529777000'