QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#102476 | #5666. Repetitive Elements | mobbb# | WA | 4ms | 3472kb | C++14 | 767b | 2023-05-03 13:45:27 | 2023-05-03 13:45:28 |
Judging History
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();
}
}
詳細信息
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'