QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#102443 | #5666. Repetitive Elements | WPS# | WA | 16ms | 3400kb | C++17 | 912b | 2023-05-03 13:15:43 | 2023-05-03 13:15:44 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
const int maxn = 3e5+10;
const int mod = 1e9+7;
const int INF = 0x3f3f3f3f3f3f3f3f;
void solve(){
string s;
cin>>s;
int len= s.size();
map<string,int>mp;
map<string,int>mp2;
string as="";
int va=0;
for(int i=0;i<len;i++){
string ts="";
for(int j=i;j<len;++j){
ts+=s[j];
int ll=ts.size();
for(int z=j+1;z<len-ll;z++){
if(s.substr(z,ll)==ts){
if(ll>va){
va=ll;
as=ts;
}
}
}
}
}
cout<<as<<endl;
}
int32_t main(){
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int T=1;
cin>>T;
while(T--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3400kb
input:
5 TATCGATCGAGTTGT TCCGCGAGCGAGTCTCTCCATT GTTTCATCATACGAGGCCCCATACGCGCTGG AGATGGGATCCTTATG GCCCTTAGGCATGGGATGTCGTTTCTTG
output:
ATCG GCGA CATACG GAT CTT
result:
ok 5 lines
Test #2:
score: -100
Wrong Answer
time: 16ms
memory: 3396kb
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 GA 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:
wrong answer 22nd lines differ - expected: 'GAG', found: 'GA'