QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#182833#5666. Repetitive ElementsbonginnWA 3ms4048kbC++14924b2023-09-18 16:39:162023-09-18 16:39:17

Judging History

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

  • [2023-09-18 16:39:17]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:4048kb
  • [2023-09-18 16:39:16]
  • 提交

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();
    }
}

Details

Tip: Click on the bar to expand more detailed information

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'