# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1007828 |
2024-06-25T14:14:12 Z |
vjudge1 |
Magnus (COCI18_magnus) |
Python 3 |
|
57 ms |
65536 KB |
import sys
sys.setrecursionlimit(10 ** 9)
def switch(current):
if current == 'H':
return 'O'
elif current == 'O':
return 'N'
elif current == 'N':
return 'I'
elif current == 'I':
return 'H'
def solve(start, s, current):
if start >= len(s):
return 0
if s[start] == current and current == 'I':
return 1 + solve(start + 1, s, switch(current))
elif s[start] == current:
return solve(start + 1, s, switch(current))
else:
return solve(start + 1, s, current)
s = input()
print(solve(0, s, 'H'))
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
2908 KB |
Output is correct |
2 |
Correct |
10 ms |
2924 KB |
Output is correct |
3 |
Correct |
12 ms |
3160 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
2908 KB |
Output is correct |
2 |
Correct |
10 ms |
2920 KB |
Output is correct |
3 |
Correct |
10 ms |
2908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
2996 KB |
Output is correct |
2 |
Correct |
10 ms |
2908 KB |
Output is correct |
3 |
Correct |
11 ms |
2972 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
2908 KB |
Output is correct |
2 |
Correct |
10 ms |
2908 KB |
Output is correct |
3 |
Correct |
10 ms |
2908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
10 ms |
2904 KB |
Output is correct |
2 |
Correct |
11 ms |
2908 KB |
Output is correct |
3 |
Correct |
10 ms |
2908 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
56 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
56 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
57 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
53 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
55 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |