QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#184842 | #5608. Determining Nucleotide Assortments | ucup-team004 | AC ✓ | 5ms | 4344kb | C++20 | 1003b | 2023-09-21 13:26:42 | 2023-09-21 13:26:44 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::string s;
std::cin >> s;
int n = s.size();
int m;
std::cin >> m;
std::vector pre(4, std::vector<int>(n + 1));
for (int i = 0; i < 4; i++) {
for (int j = 0; j < n; j++) {
pre[i][j + 1] = pre[i][j] + (s[j] == "ATGC"[i]);
}
}
for (int t = 0; t < m; t++) {
int l, r;
std::cin >> l >> r;
l--;
int p[4];
std::iota(p, p + 4, 0);
std::sort(p, p + 4,
[&](int i, int j) {
int ci = pre[i][r] - pre[i][l];
int cj = pre[j][r] - pre[j][l];
return ci > cj || (ci == cj && i < j);
});
for (int i = 0; i < 4; i++) {
std::cout << "ATGC"[p[i]];
}
std::cout << "\n";
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3832kb
input:
TATATGCTCT 3 1 10 6 10 6 6
output:
TACG TCGA GATC
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 5ms
memory: 4344kb
input:
CAGCCTAGAGTGGCAGTACCTTGACGACCAAGTGGGCAGTATCAGATTTTGACAGTATTCTATTGGATCTCCGTTACTACAGTCCATAGATTTTCCAACACGATCGGGGTTCTAGGGGAGGTTGAATCAAACTGGTGAGGTTTACACTCGAAGCAATGGCCACGACGGTTTCCGGATCGGCGGTAAGATTGGTAGGATCAAGTAGGAAAGACCGCTCTATTCTTTCCAATACCCTAAAACGGATACCCGCGGTTCTTGCATTGACGGAGGCAATACCGCAGCCTACGAAACTGTATTTGT...
output:
AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGCT AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC AGTC ...
result:
ok 25000 lines
Test #3:
score: 0
Accepted
time: 2ms
memory: 3672kb
input:
GGTGTGAAGGCGCACTACTGCCGTACGTCGACAGCCCAGATACATAAAGGACATACCTCGCCTTTCCAGCTTTACACCTTCAGAGTCGAAGCTGGTGTAAGACCAGCTGTCCTATCTGTCCCCATTTTGCAGGAGACGGAGTGCGACGGGCTGAGTTATGCGGGATTCAGATGCTTATTACAACTTGGGGGCTATGAAAACCTGGTAAGAGATAGAAGCTCCGCCCCCGACCTTATGACACCAGACCAGCGCCTGGTACACGGATCGAGCGGTGATATTTCCACTAAATTCAAGAAGCCA...
output:
CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT CGAT ...
result:
ok 10000 lines
Test #4:
score: 0
Accepted
time: 2ms
memory: 3896kb
input:
TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT...
output:
TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC TAGC ...
result:
ok 10000 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
A 1 1 1
output:
ATGC
result:
ok single line: 'ATGC'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
T 1 1 1
output:
TAGC
result:
ok single line: 'TAGC'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
G 1 1 1
output:
GATC
result:
ok single line: 'GATC'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
C 1 1 1
output:
CATG
result:
ok single line: 'CATG'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
AAAAAAAAAAAA 1 1 12
output:
ATGC
result:
ok single line: 'ATGC'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
TTTTTTTTTTTT 1 1 12
output:
TAGC
result:
ok single line: 'TAGC'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
GGGGGGGGGGGG 1 1 12
output:
GATC
result:
ok single line: 'GATC'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
CCCCCCCCCCCC 1 1 12
output:
CATG
result:
ok single line: 'CATG'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
TTTTTTAAAAAA 1 1 12
output:
ATGC
result:
ok single line: 'ATGC'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
GGGGGGAAAAAA 1 1 12
output:
AGTC
result:
ok single line: 'AGTC'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
CCCCCCAAAAAA 1 1 12
output:
ACTG
result:
ok single line: 'ACTG'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
GGGGGGTTTTTT 1 1 12
output:
TGAC
result:
ok single line: 'TGAC'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3512kb
input:
CCCCCCTTTTTT 1 1 12
output:
TCAG
result:
ok single line: 'TCAG'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3572kb
input:
CCCCCCGGGGGG 1 1 12
output:
GCAT
result:
ok single line: 'GCAT'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
GGGGTTTTAAAA 1 1 12
output:
ATGC
result:
ok single line: 'ATGC'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
CCCCTTTTAAAA 1 1 12
output:
ATCG
result:
ok single line: 'ATCG'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
CCCCGGGGAAAA 1 1 12
output:
AGCT
result:
ok single line: 'AGCT'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3508kb
input:
CCCCGGGGTTTT 1 1 12
output:
TGCA
result:
ok single line: 'TGCA'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
CCCGGGTTTAAA 1 1 12
output:
ATGC
result:
ok single line: 'ATGC'
Test #24:
score: 0
Accepted
time: 1ms
memory: 4132kb
input:
TGGTTAGAGGCGCCGACTTTCAGACGAATGTAAAGTGGAACCTCACTCCTATCGAAATAAGCAGAATCGGAGCTGGCTTGTTGGTCGAACGGAGCCCGTGTGCGGTCTTACGTAGCTCCATGAATCTGGGGATCAGGAGTGTGAACAGTCTCGGAAAACATACGTTGTTAATGTTGGCGACGTATGCCTATACCCAGCAGGCGACCAAGGGGGCAGACAAAGAGAATGGAGGGGCACCGTTACGCTTGAACGGCGACCGCGCTCGGAAACTCGAGTAGCCTTTGCGCATTACTTTTCAGT...
output:
GTCA GATC GACT TGCA AGCT TGCA TGCA GACT GCAT CAGT
result:
ok 10 lines
Test #25:
score: 0
Accepted
time: 1ms
memory: 4204kb
input:
GGGTTCGTCCAAAGCCCAGACATATCTCCCCATGATCGCAGTCGGGATGGCTTAATTCTACGCTGTCGTTCTCAATATTATTTTCGCTCAGGACTCAACGGAATCCTGGCTGTATTCAACACGACAAAGAAGGTACCCCCGCTCTTCGATTCCTTGCTGACAACTTAGCCGGCCGGAAAGCGGCCTCCGGTCGTCAATCTTGCACCTGAAGGAAACCTATACCTGCTACCACGTATGATACTCTAATCTCATTTCGGCACTGTCGTTGTTAGTGTGTGTTGTTGCGACCTGGTGGTCGAA...
output:
CGTA ATGC CAGT GCAT CGAT CAGT ACGT CGAT CAGT CGAT
result:
ok 10 lines
Test #26:
score: 0
Accepted
time: 1ms
memory: 3880kb
input:
AGCTTATCAAATACTGGCCCTAAGCTGATCCTTTAAGCGACAGTTTTGCCGACATTTACTCAAGACATCAGAGGACCGGCACAGGTCCACGCTGATTTCTAGGATACGATTCGGCCATCCGAAATAGATGTGTTACTAAGAGGGGGCCTTGGGTTCCACATGAAATCGGCGATTCCAATGAATAATAGGGACTTCCGAGATTCTCGCAGGGCAAGGGCAGAAAAACCTAAATGACCCCCAACCCTGCTAATTTCAGAACGATATGGTATCTCTACTGTATTAATCTACCGGACGCGAACT...
output:
ATGC GTCA GTCA CGTA ATCG CGTA CGTA CGTA GCTA GACT
result:
ok 10 lines
Test #27:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
ATGCGGTTTTACTGGAAGGGTATCCCACTTAGGTAATATGCATGTGAGATAACAAAAGTCAACGCATAGTTATTAATTAACGCTGGATAGAAAGCGAGAGGTACGAAATGTATGTGCTATGTGATCCTTAGCTAGTACTCCGAAGACGGTTAATTGATTCAGGTACCCTTTAGCAAAACTGACCGTAAAGGAGAGAAGGACAAGCCTGGGGCGAATCGTCCCCGTGACGGATATAGCAACATTACACGTTTATATCCGAGGTAGTATCGGCTGATACATGCTATTGATGTAGCATTTCGA...
output:
TGAC ATGC TACG ACTG GTAC TCGA TACG TAGC TACG TACG
result:
ok 10 lines
Test #28:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
ATTTAGTTCTCGGTGGCTAAATCTGTATCACTGTTACACCTTCCAAATTAAATGAGCGCCGCTTTAGTCGATTTAATGGTATATCTAACAAACATTACCGCGGAGTTGCTACGGGGAAGGATAGCGTGCCAACCACCATGGCAGCACTAACAGTGCTCGGGAGTCGGACAGGGTAACTGTGCCAAATCCCGTCGTGTGCGTTTACATCCACCCCCCTGAACCGATTTAAGTGACCTTTATTTATCACGACCAACGCGTCTGCTCTGGGGCCCATTAAGCTGCAACGCGGATAGATGCTCC...
output:
TACG TCAG TAGC TCAG TGCA ATCG TCGA TCAG GACT TGAC
result:
ok 10 lines
Test #29:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
TGCGTCCCCTGGCTAAGTGATAGGATAATCTCCATATCGCGTTGTATAGGATGCACTAAGTGTACCACAACACGATGCACCTGAGCATGAAGAAGTTGAGACTGAGTTATCGCAGAGAACTCGGCCTTTCTCCAGCCCGGCGTGCGAGAGGCACGACCGCAATATTTGACCCGCTGGTAACAGAAGACTTAGCTCCAAGGTGAGAACTGCCCTGGGATTAGTCCAGGGTGATTGTGCGCCCTCCACCCGACCCGCATTTCGTCAAATGGACGTAACACATTAACATTTGGTGACGGCCAA...
output:
TCGA TCGA TCGA TCGA TGCA TGCA TCGA CTGA TACG TCGA
result:
ok 10 lines
Test #30:
score: 0
Accepted
time: 0ms
memory: 3724kb
input:
CAACTGCAGCCCTTTAACCGAGCCCAGAGGAGGATTACAAGCTTTCGTCAGGTGCGACTCCAAACGTTACGCGGTATGGCTTTCCTAAGTCCAGTCCCCGCGTAAGCGGCAGTAATCAGTTGCGTTGGCCAACAGCCTGGCCGGCACTTCCTCTCTCTTGACATAGGGTCAAGCAGTTGGCGATTCATGTAACTTCTAGCTACCAGGCGCCTCAATCGGGAAACTCTGGAGTGACGACAGCACGTAGCTTCTTAGTATGGAACAGGATATGGAAATTGGCCAGAATTCCTGTTTACGACT...
output:
GTCA CTAG ATCG CTAG GTAC CTAG CGTA CATG CTAG TACG
result:
ok 10 lines
Test #31:
score: 0
Accepted
time: 0ms
memory: 4004kb
input:
AGGTTATGCCCACGAAGTCCAGATGTGCTCAGTACGCATCATACGCTCGCTCGGGCCTTTGGTTCCACGCGGACGTCATCTTGTGCGGGGAGTAAAGTTATCTTTTCCCGTCTTCGTTACACGTACCATTCGGCCCACTTGTACTGCGGCATCCATCTGGAAAATGTACCGGGAGCAAACTATGGGGATCGGCCCCGACTTCATCCCCCGGGTAGGGCACACTCCAGTAGCAGAGGGTACCCTCGGCGCATCCACAATAGTCGGTCCCGACGTTACGGGACGGCATCCTGTCCCATCATA...
output:
CGTA TCGA TGCA CAGT TGCA GCAT CGTA CGTA CGTA CGAT
result:
ok 10 lines
Test #32:
score: 0
Accepted
time: 1ms
memory: 3672kb
input:
TCGATACATTTATGTTTGCCGTCTTACTCCCCTCTGGTGTCCGTTCGATCGGGGATCGTCACTTGTTCTGCTAAAGAGTCTCGGGATTGGTTGAAAGTACAGCTCAGGTGTAACTAGTGGCCGGCTCGAGATAACTGCCAAATCTCTATTCCCTTGACAACTCACTAAGACAAGTTAACGGGACGTACGCGAGTATGCACAGTTAATGATTACCGGAAACGAATCTGTCCCAGACCGGCCCGATCGAACTTAAAGTGCGAATACGTAATAATTCTTACCTTTCAGGGTTATTGGATCTGA...
output:
ATCG ATGC TAGC GCTA GATC GACT CGAT TGAC GTAC GATC
result:
ok 10 lines
Test #33:
score: 0
Accepted
time: 1ms
memory: 4164kb
input:
ACTCGACAATTAGAGTCTAATAGACCGGGACAGAGTTGTGGACTAGAGACAAATCTAAAAGGCGTGTGCGCCCAGGGTTGCCTCCAGTCAGTCCGTGTCGTACCCTAGTAGCTCTAGCCAAGAATTCATTGTTGTGGCTTCACCTCGACAAGACGCCTTCCAAGATGCGGGTGTAATAGGATCGGGCACAATCGCTTTTCGGCTTGACAATCGGATAGAGCGTTGCTAGCCGGTCTGTCTGATCGATAACTACTTCGAAAAGCCCTACCAGGCGATGGGTGGTAATTTTTTAATATTCAA...
output:
ATCG ATCG AGCT AGCT ATCG AGTC AGTC CGAT GTCA GCAT
result:
ok 10 lines