QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#102472 | #5666. Repetitive Elements | ir101# | WA | 2ms | 3424kb | C++17 | 797b | 2023-05-03 13:40:56 | 2023-05-03 13:40:58 |
Judging History
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'