QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#656698 | #5666. Repetitive Elements | ucup-team5226# | AC ✓ | 4ms | 3640kb | C++20 | 947b | 2024-10-19 13:34:31 | 2024-10-19 13:34:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using str = string;
#define reps(i, a, n) for (ll i = (a); i < ll(n); i++)
#define rep(i, n) reps(i, 0, n)
void solve() {
str S;
cin >> S;
ll N = S.size();
str ans;
rep(i, N) {
reps(j, i + 1, N + 1) {
reps(k, j, N) {
if (N - k < j - i) break;
bool f = true;
rep(l, j - i) {
if (S[i + l] != S[k + l]) {
f = false;
break;
}
}
if (f) {
if (ans.size() < j - i)
ans = str(S.begin() + i, S.begin() + j);
}
}
}
}
// TATCGATCGAGTTGT
cout << ans << endl;
}
int main() {
ll t = 1;
cin >> t;
rep(i, t) solve();
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3640kb
input:
5 TATCGATCGAGTTGT TCCGCGAGCGAGTCTCTCCATT GTTTCATCATACGAGGCCCCATACGCGCTGG AGATGGGATCCTTATG GCCCTTAGGCATGGGATGTCGTTTCTTG
output:
ATCG GCGA CATACG GAT CTT
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 4ms
memory: 3600kb
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 GAG 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:
ok 50 lines