QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#763469#9578. 爱上字典renewAC ✓373ms111324kbPython3911b2024-11-19 20:26:492024-11-19 20:26:49

Judging History

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

  • [2024-11-19 20:26:49]
  • 评测
  • 测评结果:AC
  • 用时:373ms
  • 内存:111324kb
  • [2024-11-19 20:26:49]
  • 提交

answer

import re

# Read the novel text
s = input()

# Read the number of known words
n = int(input())

# Read the known words and store them in a set (case-insensitive)
vis = set()
if n > 0:
    known_words_line = input().strip().split()
    for word in known_words_line:
        vis.add(word.lower())

# Extract words from the novel text using regular expressions
# Words are sequences of alphabetic characters (letters only)
words = re.findall(r'[A-Za-z]+', s)

# Initialize the lookup counter
ans = 0

# Process each word in the novel text
for word in words:
    # Convert the word to lowercase for case-insensitive comparison
    word_lower = word.lower()
    # If the word is not in the known words, count it and add to known words
    if word_lower not in vis:
        vis.add(word_lower)
        ans += 1

# Output the number of times Xiao Xing needs to look up words
print(ans)

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

input:

I love Liaoning. Love Dalian!
1
love

output:

3

result:

ok single line: '3'

Test #2:

score: 0
Accepted
time: 18ms
memory: 11140kb

input:

Sulfox Loves Furry! Fur fur Furred.
2
anthropomorphic furry

output:

4

result:

ok single line: '4'

Test #3:

score: 0
Accepted
time: 14ms
memory: 11124kb

input:

Ginkgo leaves dance lightly and fall, reflecting the autumn light on the golden ground. Time is as peaceful as when we first met.
5
ginkgo reflect is as we

output:

17

result:

ok single line: '17'

Test #4:

score: 0
Accepted
time: 207ms
memory: 75104kb

input:

Eunuchism overterrible furbelow gantlet. Sophism thyroiditis thermoelectricity hassel misreward Barolong biradiated? Sweetie fatal delinquence unseemlily beamish inwork, azyme kamias Hans asteatosis synderesis champleve cheth? Dinitrile podial presentee! Waxmaker scleroscope ratably hectography lamp...

output:

201961

result:

ok single line: '201961'

Test #5:

score: 0
Accepted
time: 204ms
memory: 75236kb

input:

Unsubsidiary unsacrificeable hacking colberter pseudoappendicitis rufescence tumbak? Hypocrize aithochroi. Spina machar proximation? Chaperone vermicide virescent Klan preplacental unabsolvedness Sarcosporida noveletter waspishness sponge trustle bistetrazole prepositure melamed, cinephone. Physopho...

output:

201951

result:

ok single line: '201951'

Test #6:

score: 0
Accepted
time: 213ms
memory: 75336kb

input:

Baikerite discontentful semicitizen Acoemetic veracity pretechnical bloodweed cytogenetic icebound disrelishable leader meltedness heroship sciniph gunsel fatalistically unreasoned anticatarrhal? Unmentioned! Overaddiction broomy misapplication hecte inflammable disheart dicaryon blacktail prisonabl...

output:

201759

result:

ok single line: '201759'

Test #7:

score: 0
Accepted
time: 206ms
memory: 73816kb

input:

Dizoic filtering damenization bistipuled Opisthothelae multiangular blaff mortally. Perfusive alkaptonuria possessorial coinstantaneousness Stanhopea Nascan. Ankylostoma aumil oxygenicity cubhood abandonee fishman poppy pickpole synkinesis arteriosclerosis coloproctitis prematrimonial pseudoviaduct ...

output:

202281

result:

ok single line: '202281'

Test #8:

score: 0
Accepted
time: 217ms
memory: 79960kb

input:

Thelorrhagia me Camaldulian Menfra me drugman pneumonolithiasis, fructose me inwit caubeen manchet! Enjeopardy me quindecennial me unrecompensable creaturize undiverting bitty dama interteam curfew excedent me me. Revealingness Nipponism opticity suwe me stilty me antiquarism Iacchic me contrapuntal...

output:

195780

result:

ok single line: '195780'

Test #9:

score: 0
Accepted
time: 373ms
memory: 111324kb

input:

Me me me me me me me me me me me me me me me. Me me. Me. Me me me me? Me me me me me me me me, me me! Me me. Me me me me me me me me me! Me me? Me me, me? Me me me me me me me me me, me me me me me? Me, me me me me me me me me me me me me me me me me? Me me me. Me me me me me, me me me me me me me! ...

output:

0

result:

ok single line: '0'

Test #10:

score: 0
Accepted
time: 361ms
memory: 110244kb

input:

Me me? Me me me me me me me me me me me, me me me. Me me me me me me me me me me me me me. Me, me me me me me me me me. Me me me me me me me me me me. Me me me me me me me me me me me me me! Me! Me me me! Me me me me me! Me me me me me me me me me me me! Me me me me me me? Me me me me me me. Me me m...

output:

0

result:

ok single line: '0'

Test #11:

score: 0
Accepted
time: 250ms
memory: 78456kb

input:

Subsemitone me pauperdom me amphopeptone me Keplerian isopolity premaniacal logia, unseducible gulper heterostylism contumeliously prevenience, clientry theurgically supportive. Me gossipiness lately electrooptic. Me. Me, boding, putrefacient unendowing hypercryalgesia me me pluviographic Elohist me...

output:

195507

result:

ok single line: '195507'

Test #12:

score: 0
Accepted
time: 13ms
memory: 11004kb

input:

I am a cat and an ant? An ape! And Imp. And imp Is I.
3
an industrialization is

output:

8

result:

ok single line: '8'

Test #13:

score: 0
Accepted
time: 13ms
memory: 11124kb

input:

Okay.
0

output:

1

result:

ok single line: '1'

Extra Test:

score: 0
Extra Test Passed