Task: | HIIT remains |
Sender: | oneofususespy |
Submission time: | 2024-09-28 13:23:36 +0300 |
Language: | Python3 (PyPy3) |
Status: | READY |
Result: | RUNTIME ERROR |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.05 s | details |
#2 | ACCEPTED | 0.60 s | details |
#3 | RUNTIME ERROR | 0.34 s | details |
#4 | RUNTIME ERROR | 0.34 s | details |
Code
hiit_ = {"": (0, 0, 0, 0)} def hiit(s): if s in hiit_: return hiit_[s] if s == "": return (0, 0, 0, 0) last = s[-1] h, hi, hii, hiii = hiit(s[:-1]) if last == "H": hiit_[s] = (h + 1, hi, hii, hiii) return (h + 1, hi, hii, hiii) elif last == "I": hiit_[s] = (h, hi + h, hii + hi, hiii) return (h, hi + h, hii + hi, hiii) elif last == "T": hiit_[s] = (h, hi, hii, hiii + hii) return (h, hi, hii, hiii + hii) else: hiit_[s] = (h, hi, hii, hiii) return (h, hi, hii, hiii) if __name__ == "__main__": n = int(input()) for _ in range(n): s = input() print(hiit(s)[3])
Test details
Test 1
Verdict: ACCEPTED
input |
---|
100 IIITIIIHITHTHIIITIII HIHIIIIIIHIIITHIIIII ITTIIIITIIIIIIITIIIT IITHITITIHHIITTTIIII ... |
correct output |
---|
12 84 0 37 96 ... |
user output |
---|
12 84 0 37 96 ... Truncated |
Test 2
Verdict: ACCEPTED
input |
---|
100 TIIHHITTITITIHTHIIIITHIHHIIHTI... |
correct output |
---|
606723862 621369559 655243897 550750615 717769300 ... |
user output |
---|
606723862 621369559 655243897 550750615 717769300 ... Truncated |
Test 3
Verdict: RUNTIME ERROR
input |
---|
10 TTHTHHTIIIIIITHIIHIITITTITTIIH... |
correct output |
---|
64668032062669502 66159978956790306 65755072918424640 64408596558953628 65238005187079543 ... |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 27, in <module> print(...
Test 4
Verdict: RUNTIME ERROR
input |
---|
3 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHH... |
correct output |
---|
781234375000000000 4999750003 0 |
user output |
---|
(empty) |
Error:
Traceback (most recent call last): File "input/code.py", line 27, in <module> print(...