QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#336252 | #8287. Caught in the Middle | ucup-team112# | WA | 3ms | 9416kb | Python3 | 654b | 2024-02-24 14:13:22 | 2024-02-24 14:13:23 |
Judging History
answer
import sys
from sys import stdin
TT = int(stdin.readline())
ANS = []
for loop in range(TT):
N = int(stdin.readline())
s = list(stdin.readline()[:-1])
stk = []
for c in s:
if c == "L":
stk.append(c)
else:
if len(stk) > 0 and stk[-1] == "L":
stk.pop()
else:
stk.append(c)
L = 0
R = 0
for c in stk:
if c == "L":
L += 1
else:
R += 1
if L == R:
ANS.append("Bob")
else:
ANS.append("Alice")
print (*ANS,sep="\n")
详细
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 9416kb
input:
20 10 RLRRRRLLRR 10 LRLLLLRRLR 6 RLRLRL 10 LLRLRRRRLR 6 LRRLLL 3 RLR 5 LLRRR 6 RRRRRL 9 LRRRLRRLR 1 R 10 RRRLLRRLLL 6 LRLLLR 9 LLRLRLRLR 7 RRRRLRR 2 LL 10 RRRLLRRLRR 2 RL 7 RRLRRLR 3 LLR 10 LLRLRRRLLR
output:
Alice Alice Bob Alice Alice Alice Alice Alice Alice Alice Bob Alice Alice Alice Alice Alice Bob Alice Alice Bob
result:
wrong answer 20th lines differ - expected: 'Alice', found: 'Bob'