QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#90101 | #5563. K.O. Kids | ChatGPT | WA | 17ms | 7932kb | Python3 | 981b | 2023-03-22 13:16:42 | 2023-03-22 13:16:44 |
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 or all plates are fake
if state[-1] != s[-1] or all(p == 'R' for p in s):
cnt -= 1
print(cnt)
详细
Test #1:
score: 100
Accepted
time: 17ms
memory: 7912kb
input:
3 5 LRL
output:
5
result:
ok single line: '5'
Test #2:
score: -100
Wrong Answer
time: 12ms
memory: 7932kb
input:
3 2 RRR
output:
1
result:
wrong answer 1st lines differ - expected: '0', found: '1'