QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#182833 | #5666. Repetitive Elements | bonginn | WA | 3ms | 4048kb | C++14 | 924b | 2023-09-18 16:39:16 | 2023-09-18 16:39:17 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define IOS cin.tie(0);ios_base::sync_with_stdio(false);
#define INF 1e15+9
using namespace std;
const int maxn = 2e5+5;
typedef pair<int,int> P;
void solve(){
string s;
cin >> s;
map <string,bool> mp[s.size() + 5];
string ans ;
int mx = 0;
for(int i=0;i<s.size();i++){
string now = "";
for(int j=i;j>=0;j--){
now = s[j] + now;
for(int k=j-1;k>=0;k--){
if(mp[k][now]){
if(now.size() >= mx){
mx = now.size();
ans = now;
}
}
}
mp[i][now] = true;
}
}
cout << ans << '\n';
}
signed main(){IOS
int T;
cin >> T;
while(T--){
solve();
}
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 4048kb
input:
5 TATCGATCGAGTTGT TCCGCGAGCGAGTCTCTCCATT GTTTCATCATACGAGGCCCCATACGCGCTGG AGATGGGATCCTTATG GCCCTTAGGCATGGGATGTCGTTTCTTG
output:
TCGA CGAG CATACG ATG CTT
result:
wrong answer 1st lines differ - expected: 'ATCG', found: 'TCGA'