QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#102472#5666. Repetitive Elementsir101#WA 2ms3424kbC++17797b2023-05-03 13:40:562023-05-03 13:40:58

Judging History

This is the latest submission verdict.

  • [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:40:58]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 3424kb
  • [2023-05-03 13:40:56]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define inf 0x3f3f3f3f
const int N=1e5+10;
int main(){
    ios::sync_with_stdio(0);cin.tie(0),cout.tie(0);
    int t;cin>>t;
    while(t--) {
        int ans = -1, cnt;
        string s,res,tt;
        cin >> s;
        for (int j = 1; j <s.size(); j++) {
        for (int i = s.size()-j; i >=0; i--) {
            tt = s.substr(i, j);
            string ee = s.substr(i + j );
            while (ee.find(tt) != -1 && ee.find(tt) < 110) {
                int pos = ee.find(tt);
                ee.erase(pos, j);
                cnt++;
            }
            if(cnt>ans){
                ans=cnt;res=tt;
            }
        }
    }
        cout<<res<<endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 3424kb

input:

5
TATCGATCGAGTTGT
TCCGCGAGCGAGTCTCTCCATT
GTTTCATCATACGAGGCCCCATACGCGCTGG
AGATGGGATCCTTATG
GCCCTTAGGCATGGGATGTCGTTTCTTG

output:

TATCGATCGAGTTG
TCCGCGAGCGAGTCTCTCCAT
GTTTCATCATACGAGGCCCCATACGCGCTG
AGATGGGATCCTTAT
GCCCTTAGGCATGGGATGTCGTTTCTT

result:

wrong answer 1st lines differ - expected: 'ATCG', found: 'TATCGATCGAGTTG'