QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#677531 | #5666. Repetitive Elements | Forever_Young# | AC ✓ | 1ms | 3796kb | C++14 | 629b | 2024-10-26 12:35:06 | 2024-10-26 12:35:09 |
Judging History
answer
#include<bits/stdc++.h>
#define mp make_pair
#define se second
#define fi first
using namespace std;
int t,l;
pair<int,int> res;
char ch[110];
int main(){
scanf("%d",&t);
while (t--){
scanf("%s",ch);
l=strlen(ch);
res=mp(0,0);
for (int i=0;i<l;i++)
for (int j=i+1;j<l;j++)
for (int s=0;s<l;s++)
if (ch[i+s]!=ch[j+s]||i+s>=j) break;
else{
if (s+1>res.se) res=mp(i,s+1);
}
for (int i=res.fi;i<res.fi+res.se;i++) printf("%c",ch[i]);
printf("\n");
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3796kb
input:
5 TATCGATCGAGTTGT TCCGCGAGCGAGTCTCTCCATT GTTTCATCATACGAGGCCCCATACGCGCTGG AGATGGGATCCTTATG GCCCTTAGGCATGGGATGTCGTTTCTTG
output:
ATCG GCGA CATACG GAT CTT
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3788kb
input:
50 TTGACAACTTCAGGTTGGCACTCCTTCATTTGGATTTCGGAATAATAGTTTTCTGCTCTGCC ATCCTATTCGGGGATAGGAGAGATGGGTTGCCGCTATAAAAGCATTTGAACTCCATTTCACTCCGTTGGCTAGGGGTCGCACTG CCGTAATATAAAGACTCGGAATTCCAATAGCTGCTATTTGCGAGTATGTGACTGAAAACACACCTATAAATATTAGCTGCGTACAAGCTA ATGGCTGCATGCAGGGTCGACTAGACACACTTTGTCT TTGAGGATGTCGACGTGTCT...
output:
CTTCA CATTT TAGCTGC TGCA ACGTG GCGCCGG CTCTT AGTAT AGAG ACAG TAT TGAC CTTG CGTC TACTGG GCCGGT GAA CAGTA GCGT GGTT CCCT GAG TAGAC GGTGC GCAGT TGAG ATCAA CCACACA GAGTC ATGTA ATGGTA TATA TATGAA TTCC CATACG TACCA TTAG GGAATGT CAGG GCT AAG CTGT GGAT TCTTC AAAAC ATG GATAA TTA ACATAT CAAT
result:
ok 50 lines