QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#90092 | #5788. Alien Language | ChatGPT | 33 ✓ | 596ms | 10064kb | Python3 | 705b | 2023-03-22 12:11:50 | 2023-03-22 12:11:51 |
Judging History
answer
import re
def count_pattern_matches(L, D, N, words, patterns):
results = []
for pattern in patterns:
regex_pattern = pattern.replace('(', '[').replace(')', ']')
regex = re.compile(regex_pattern)
matches = sum(1 for word in words if regex.fullmatch(word))
results.append(matches)
return results
def main():
L, D, N = map(int, input().split())
words = [input().strip() for _ in range(D)]
patterns = [input().strip() for _ in range(N)]
results = count_pattern_matches(L, D, N, words, patterns)
for i, result in enumerate(results, start=1):
print(f"Case #{i}: {result}")
if __name__ == "__main__":
main()
详细
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 19ms
memory: 8980kb
input:
10 25 10 ubjwqxhwfd myzbivqwwd mdynwjlxby swbburyeqf hcdignewka byfzobkbym zskbvgutkk arpdavrgtd gudnwrogsp uuhexdnryx ebrtetqxzl chfgubziks zemjlloycm xgpobuhtti ewpkejndux xtelepwsnb hmhwblskem tjkivquitq itlmeqddis epelmfwesd slmcthspro fbjrpnhsqr kuhpitwgzo jszvwvermw hsxqlndufw lsssjcnfjn g(rsu...
output:
Case #1: 0 Case #2: 1 Case #3: 0 Case #4: 1 Case #5: 5 Case #6: 6 Case #7: 1 Case #8: 4 Case #9: 1 Case #10: 5
result:
ok 10 lines
Subtask #2:
score: 23
Accepted
Test #2:
score: 23
Accepted
time: 596ms
memory: 10064kb
input:
15 5000 500 ubjwqxhwfdmyzbi vqwwdmdynwjlxby swbburyeqfhcdig newkabyfzobkbym zskbvgutkkarpda vrgtdgudnwrogsp uuhexdnryxebrte tqxzlchfgubziks zemjlloycmxgpob uhttiewpkejndux xtelepwsnbhmhwb lskemtjkivquitq itlmeqddisepelm fwesdslmcthspro fbjrpnhsqrkuhpi twgzojszvwvermw hsxqlndufwlsssj cnfjnwsfvqdsuuf ...
output:
Case #1: 0 Case #2: 1 Case #3: 0 Case #4: 1 Case #5: 735 Case #6: 371 Case #7: 1 Case #8: 355 Case #9: 1 Case #10: 547 Case #11: 0 Case #12: 1 Case #13: 0 Case #14: 1 Case #15: 279 Case #16: 528 Case #17: 1 Case #18: 450 Case #19: 1 Case #20: 477 Case #21: 0 Case #22: 1 Case #23: 0 Case #24: 1 Case ...
result:
ok 500 lines
Extra Test:
score: 0
Extra Test Passed