QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#325104 | #5608. Determining Nucleotide Assortments | aggrovector# | AC ✓ | 19ms | 5260kb | C++14 | 1.3kb | 2024-02-11 04:17:43 | 2024-02-11 04:17:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
long long n,q,sa[50005],sc[50005],sg[50005],st[50005],l,r,i;
string ss;
char s[500005];
map<char,int> order;
struct dna {
char c;
long long x;
} cnt[10];
bool cmp(dna p, dna q) {
if (p.x==q.x) {
return order[p.c]<order[q.c];
}
return p.x>q.x;
}
int main() {
order['A']=1;
order['T']=2;
order['G']=3;
order['C']=4;
cin >> ss;
n=ss.length();
for (i=1;i<=n;i++) {
s[i]=ss[i-1];
}
for (i=1;i<=n;i++) {
sa[i]=sa[i-1];
sc[i]=sc[i-1];
sg[i]=sg[i-1];
st[i]=st[i-1];
if (s[i]=='A') {
sa[i]++;
}
if (s[i]=='C') {
sc[i]++;
}
if (s[i]=='G') {
sg[i]++;
}
if (s[i]=='T') {
st[i]++;
}
}
cin >> q;
while(q--) {
cin >> l >> r;
cnt[1].x=sa[r]-sa[l-1];
cnt[2].x=sc[r]-sc[l-1];
cnt[3].x=sg[r]-sg[l-1];
cnt[4].x=st[r]-st[l-1];
cnt[1].c='A';
cnt[2].c='C';
cnt[3].c='G';
cnt[4].c='T';
sort(cnt+1,cnt+5,cmp);
for (i=1;i<=4;i++) {
cout << cnt[i].c;
}
cout << endl;
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
input:
TATATGCTCT 3 1 10 6 10 6 6
output:
TACG TCGA GATC
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 19ms
memory: 5252kb
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: 4ms
memory: 4372kb
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: 4ms
memory: 4312kb
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: 3596kb
input:
A 1 1 1
output:
ATGC
result:
ok single line: 'ATGC'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
T 1 1 1
output:
TAGC
result:
ok single line: 'TAGC'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
G 1 1 1
output:
GATC
result:
ok single line: 'GATC'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
C 1 1 1
output:
CATG
result:
ok single line: 'CATG'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3492kb
input:
AAAAAAAAAAAA 1 1 12
output:
ATGC
result:
ok single line: 'ATGC'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
TTTTTTTTTTTT 1 1 12
output:
TAGC
result:
ok single line: 'TAGC'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
GGGGGGGGGGGG 1 1 12
output:
GATC
result:
ok single line: 'GATC'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
CCCCCCCCCCCC 1 1 12
output:
CATG
result:
ok single line: 'CATG'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
TTTTTTAAAAAA 1 1 12
output:
ATGC
result:
ok single line: 'ATGC'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
GGGGGGAAAAAA 1 1 12
output:
AGTC
result:
ok single line: 'AGTC'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3480kb
input:
CCCCCCAAAAAA 1 1 12
output:
ACTG
result:
ok single line: 'ACTG'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
GGGGGGTTTTTT 1 1 12
output:
TGAC
result:
ok single line: 'TGAC'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
CCCCCCTTTTTT 1 1 12
output:
TCAG
result:
ok single line: 'TCAG'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
CCCCCCGGGGGG 1 1 12
output:
GCAT
result:
ok single line: 'GCAT'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
GGGGTTTTAAAA 1 1 12
output:
ATGC
result:
ok single line: 'ATGC'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
CCCCTTTTAAAA 1 1 12
output:
ATCG
result:
ok single line: 'ATCG'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3496kb
input:
CCCCGGGGAAAA 1 1 12
output:
AGCT
result:
ok single line: 'AGCT'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
CCCCGGGGTTTT 1 1 12
output:
TGCA
result:
ok single line: 'TGCA'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
CCCGGGTTTAAA 1 1 12
output:
ATGC
result:
ok single line: 'ATGC'
Test #24:
score: 0
Accepted
time: 2ms
memory: 5236kb
input:
TGGTTAGAGGCGCCGACTTTCAGACGAATGTAAAGTGGAACCTCACTCCTATCGAAATAAGCAGAATCGGAGCTGGCTTGTTGGTCGAACGGAGCCCGTGTGCGGTCTTACGTAGCTCCATGAATCTGGGGATCAGGAGTGTGAACAGTCTCGGAAAACATACGTTGTTAATGTTGGCGACGTATGCCTATACCCAGCAGGCGACCAAGGGGGCAGACAAAGAGAATGGAGGGGCACCGTTACGCTTGAACGGCGACCGCGCTCGGAAACTCGAGTAGCCTTTGCGCATTACTTTTCAGT...
output:
GTCA GATC GACT TGCA AGCT TGCA TGCA GACT GCAT CAGT
result:
ok 10 lines
Test #25:
score: 0
Accepted
time: 2ms
memory: 5224kb
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: 4696kb
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: 3732kb
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: 4244kb
input:
ATTTAGTTCTCGGTGGCTAAATCTGTATCACTGTTACACCTTCCAAATTAAATGAGCGCCGCTTTAGTCGATTTAATGGTATATCTAACAAACATTACCGCGGAGTTGCTACGGGGAAGGATAGCGTGCCAACCACCATGGCAGCACTAACAGTGCTCGGGAGTCGGACAGGGTAACTGTGCCAAATCCCGTCGTGTGCGTTTACATCCACCCCCCTGAACCGATTTAAGTGACCTTTATTTATCACGACCAACGCGTCTGCTCTGGGGCCCATTAAGCTGCAACGCGGATAGATGCTCC...
output:
TACG TCAG TAGC TCAG TGCA ATCG TCGA TCAG GACT TGAC
result:
ok 10 lines
Test #29:
score: 0
Accepted
time: 1ms
memory: 4292kb
input:
TGCGTCCCCTGGCTAAGTGATAGGATAATCTCCATATCGCGTTGTATAGGATGCACTAAGTGTACCACAACACGATGCACCTGAGCATGAAGAAGTTGAGACTGAGTTATCGCAGAGAACTCGGCCTTTCTCCAGCCCGGCGTGCGAGAGGCACGACCGCAATATTTGACCCGCTGGTAACAGAAGACTTAGCTCCAAGGTGAGAACTGCCCTGGGATTAGTCCAGGGTGATTGTGCGCCCTCCACCCGACCCGCATTTCGTCAAATGGACGTAACACATTAACATTTGGTGACGGCCAA...
output:
TCGA TCGA TCGA TCGA TGCA TGCA TCGA CTGA TACG TCGA
result:
ok 10 lines
Test #30:
score: 0
Accepted
time: 1ms
memory: 3856kb
input:
CAACTGCAGCCCTTTAACCGAGCCCAGAGGAGGATTACAAGCTTTCGTCAGGTGCGACTCCAAACGTTACGCGGTATGGCTTTCCTAAGTCCAGTCCCCGCGTAAGCGGCAGTAATCAGTTGCGTTGGCCAACAGCCTGGCCGGCACTTCCTCTCTCTTGACATAGGGTCAAGCAGTTGGCGATTCATGTAACTTCTAGCTACCAGGCGCCTCAATCGGGAAACTCTGGAGTGACGACAGCACGTAGCTTCTTAGTATGGAACAGGATATGGAAATTGGCCAGAATTCCTGTTTACGACT...
output:
GTCA CTAG ATCG CTAG GTAC CTAG CGTA CATG CTAG TACG
result:
ok 10 lines
Test #31:
score: 0
Accepted
time: 1ms
memory: 4708kb
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: 4560kb
input:
TCGATACATTTATGTTTGCCGTCTTACTCCCCTCTGGTGTCCGTTCGATCGGGGATCGTCACTTGTTCTGCTAAAGAGTCTCGGGATTGGTTGAAAGTACAGCTCAGGTGTAACTAGTGGCCGGCTCGAGATAACTGCCAAATCTCTATTCCCTTGACAACTCACTAAGACAAGTTAACGGGACGTACGCGAGTATGCACAGTTAATGATTACCGGAAACGAATCTGTCCCAGACCGGCCCGATCGAACTTAAAGTGCGAATACGTAATAATTCTTACCTTTCAGGGTTATTGGATCTGA...
output:
ATCG ATGC TAGC GCTA GATC GACT CGAT TGAC GTAC GATC
result:
ok 10 lines
Test #33:
score: 0
Accepted
time: 2ms
memory: 5260kb
input:
ACTCGACAATTAGAGTCTAATAGACCGGGACAGAGTTGTGGACTAGAGACAAATCTAAAAGGCGTGTGCGCCCAGGGTTGCCTCCAGTCAGTCCGTGTCGTACCCTAGTAGCTCTAGCCAAGAATTCATTGTTGTGGCTTCACCTCGACAAGACGCCTTCCAAGATGCGGGTGTAATAGGATCGGGCACAATCGCTTTTCGGCTTGACAATCGGATAGAGCGTTGCTAGCCGGTCTGTCTGATCGATAACTACTTCGAAAAGCCCTACCAGGCGATGGGTGGTAATTTTTTAATATTCAA...
output:
ATCG ATCG AGCT AGCT ATCG AGTC AGTC CGAT GTCA GCAT
result:
ok 10 lines