QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#90100 | #5563. K.O. Kids | ChatGPT | WA | 13ms | 8028kb | Python3 | 930b | 2023-03-22 13:15:59 | 2023-03-22 13:16:03 |
Judging History
answer
n, k = map(int, input().split())
s = input()
# start with all kids making it to the other side
cnt = k
# current state of the bridge, initially all plates are unknown
state = ['U'] * n
# first player always chooses left at first step
state[0] = 'L'
# simulate the game for all players
for i in range(1, k):
# copy the current state
prev_state = state.copy()
# follow the correct choices as far as they are known
for j in range(n):
if s[j] == prev_state[j]:
state[j] = prev_state[j]
else:
state[j] = 'U'
break
# apply the switching strategy
for j in range(n):
if state[j] == 'U':
if prev_state[j] == 'L':
state[j] = 'R'
else:
state[j] = 'L'
# check if the player falls at the last step
if state[-1] != s[-1]:
cnt -= 1
print(cnt)
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 8ms
memory: 8028kb
input:
3 5 LRL
output:
5
result:
ok single line: '5'
Test #2:
score: -100
Wrong Answer
time: 13ms
memory: 7936kb
input:
3 2 RRR
output:
1
result:
wrong answer 1st lines differ - expected: '0', found: '1'