QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#744954#5680. You You See What?MattTheNub#WA 12ms10488kbPython3625b2024-11-14 00:41:352024-11-14 00:41:35

Judging History

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

  • [2024-11-14 00:41:35]
  • 评测
  • 测评结果:WA
  • 用时:12ms
  • 内存:10488kb
  • [2024-11-14 00:41:35]
  • 提交

answer

s = input()
path = s.split("!")


res = []
for i in range(len(path)):
    adj = []
    if i > 0:
        adj.append(path[i - 1].lower())
    if i < len(path) - 1:
        adj.append(path[i + 1].lower())
    for j in range(i):
        if path[j].lower() != path[i].lower():
            continue
        ok = False
        if j > 0 and path[j - 1].lower() in adj:
            ok = True
        if j < len(path) - 1 and path[j + 1].lower() in adj:
            ok = True
        if ok:
            while j in res:
                res.pop()
    res.append(i)

print("!".join(map(lambda i: path[i], res)))

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 12ms
memory: 10488kb

input:

texasam!rice!baylor!csdept!baylor!rice!dev!bresearch!bpoucher

output:

texasam!rice!dev!bresearch!bpoucher

result:

ok single line: 'texasam!rice!dev!bresearch!bpoucher'

Test #2:

score: -100
Wrong Answer
time: 10ms
memory: 10452kb

input:

texasam!Rice!baYlor!csdept!BayloR!dev!Rice!bresearch!bpoucher

output:

texasam!Rice!BayloR!dev!Rice!bresearch!bpoucher

result:

wrong answer 1st lines differ - expected: 'texasam!Rice!baYlor!dev!Rice!bresearch!bpoucher', found: 'texasam!Rice!BayloR!dev!Rice!bresearch!bpoucher'