QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#336252#8287. Caught in the Middleucup-team112#WA 3ms9416kbPython3654b2024-02-24 14:13:222024-02-24 14:13:23

Judging History

你现在查看的是最新测评结果

  • [2024-02-24 14:13:23]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:9416kb
  • [2024-02-24 14:13:22]
  • 提交

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'