QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#102476#5666. Repetitive Elementsmobbb#WA 4ms3472kbC++14767b2023-05-03 13:45:272023-05-03 13:45:28

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-03 13:45:28]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:3472kb
  • [2023-05-03 13:45:27]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define double long double
using namespace std;
const int N = 1e5 + 7;
int n;
void OvO(){
    string s;cin >> s;
    string res;
    n = s.size();
    res = s[0];
    s = ' ' + s;
    for (int len = 1;len <= n;len++){
        for (int l = 1;l <= n - len + 1;l++){
            string tt = s.substr(l + len,n - l - len);
            string pp = s.substr(l,len);
            if (tt.find(pp) != -1){
               if (res.size() < pp.size())
                    res = pp;
            }
        }
    }
    cout << res << endl;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int _ = 1;cin>>_;
    while(_--){
        OvO();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3416kb

input:

5
TATCGATCGAGTTGT
TCCGCGAGCGAGTCTCTCCATT
GTTTCATCATACGAGGCCCCATACGCGCTGG
AGATGGGATCCTTATG
GCCCTTAGGCATGGGATGTCGTTTCTTG

output:

ATCG
GCGA
CATACG
GAT
CTT

result:

ok 5 lines

Test #2:

score: -100
Wrong Answer
time: 4ms
memory: 3472kb

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'