QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#117177#5666. Repetitive ElementsbakuganulitWA 22ms8136kbPython3394b2023-06-30 16:06:142023-06-30 16:06:15

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-30 16:06:15]
  • 评测
  • 测评结果:WA
  • 用时:22ms
  • 内存:8136kb
  • [2023-06-30 16:06:14]
  • 提交

answer

def solve():
    r = ""
    k = input()
    for i in range(2, len(k)//2):
        for l in range(1, (len(k)-1)//2):
            pattern = k[l:l+i]
            if pattern in k[:l] or pattern in k[l+i:]:
                if len(pattern) > len(r):
                    r = pattern
    print(r)


if __name__ == "__main__":
    t = int(input())

    for i in range(t):
        solve()

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 11ms
memory: 8076kb

input:

5
TATCGATCGAGTTGT
TCCGCGAGCGAGTCTCTCCATT
GTTTCATCATACGAGGCCCCATACGCGCTGG
AGATGGGATCCTTATG
GCCCTTAGGCATGGGATGTCGTTTCTTG

output:

ATCG
GCGA
CATACG
GAT
CTT

result:

ok 5 lines

Test #2:

score: -100
Wrong Answer
time: 22ms
memory: 8136kb

input:

50
TTGACAACTTCAGGTTGGCACTCCTTCATTTGGATTTCGGAATAATAGTTTTCTGCTCTGCC
ATCCTATTCGGGGATAGGAGAGATGGGTTGCCGCTATAAAAGCATTTGAACTCCATTTCACTCCGTTGGCTAGGGGTCGCACTG
CCGTAATATAAAGACTCGGAATTCCAATAGCTGCTATTTGCGAGTATGTGACTGAAAACACACCTATAAATATTAGCTGCGTACAAGCTA
ATGGCTGCATGCAGGGTCGACTAGACACACTTTGTCT
TTGAGGATGTCGACGTGTCT...

output:

CTTCA
CTAT
TAGCTGC
TGCA
ACGTG
AGGAA
CTCTT
AGTAT
GAGC
GAGT
TAT
TGAC
TGC
CGTC
TACTGG
CCGGT
AAA
CAGTA
GCGT
GGTT
CCCT
GAG
TAGAC
GGTGC
GCAGT
TGAG
ATCAA
CCACACA
CAAG
ATGTA
ATGGTA
TATA
TATGAA
CGT
CATACG
TACCA
TTAG
GGAATGT
CAGG
GCT
AG
ACAC
ATGT
TCTTC
AAAAC
GCT
GATAA
TTA
ACATAT
AAT

result:

wrong answer 2nd lines differ - expected: 'CATTT', found: 'CTAT'