QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#94666#5608. Determining Nucleotide AssortmentsPetroTarnavskyi#AC ✓12ms4032kbC++20994b2023-04-07 14:41:112023-04-07 14:41:13

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-07 14:41:13]
  • 评测
  • 测评结果:AC
  • 用时:12ms
  • 内存:4032kb
  • [2023-04-07 14:41:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define MP make_pair
#define PB push_back
#define F first
#define S second

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	map<char, int> m;
	m['A'] = 3;
	m['T'] = 2;
	m['G'] = 1;
	m['C'] = 0;
	string t = "CGTA";
	
	string s;
	cin >> s;
	
	int n = s.length();
	
	vector<VI> v(4, VI(n + 1));
	FOR(i, 0, n)
		v[m[s[i]]][i + 1] = 1;
	
	FOR(i, 0, 4)
		FOR(j, 0, n) v[i][j + 1] += v[i][j];
	
	int q;
	cin >> q;
	FOR(i, 0, q)
	{
		vector<PII> ans;
		int l, r;
		cin >> l >> r;
		FOR(j, 0, 4) ans.PB({v[j][r] - v[j][l - 1], j});
		sort(ALL(ans));
		reverse(ALL(ans));
		FOR(j, 0, 4) cout << t[ans[j].second];
		cout << '\n';
	}
	
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3288kb

input:

TATATGCTCT
3
1 10
6 10
6 6

output:

TACG
TCGA
GATC

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 12ms
memory: 4032kb

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: 6ms
memory: 3480kb

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: 3ms
memory: 3552kb

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: 2ms
memory: 3336kb

input:

A
1
1 1

output:

ATGC

result:

ok single line: 'ATGC'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3352kb

input:

T
1
1 1

output:

TAGC

result:

ok single line: 'TAGC'

Test #7:

score: 0
Accepted
time: 2ms
memory: 3428kb

input:

G
1
1 1

output:

GATC

result:

ok single line: 'GATC'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3288kb

input:

C
1
1 1

output:

CATG

result:

ok single line: 'CATG'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3380kb

input:

AAAAAAAAAAAA
1
1 12

output:

ATGC

result:

ok single line: 'ATGC'

Test #10:

score: 0
Accepted
time: 2ms
memory: 3288kb

input:

TTTTTTTTTTTT
1
1 12

output:

TAGC

result:

ok single line: 'TAGC'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3376kb

input:

GGGGGGGGGGGG
1
1 12

output:

GATC

result:

ok single line: 'GATC'

Test #12:

score: 0
Accepted
time: 2ms
memory: 3292kb

input:

CCCCCCCCCCCC
1
1 12

output:

CATG

result:

ok single line: 'CATG'

Test #13:

score: 0
Accepted
time: 2ms
memory: 3372kb

input:

TTTTTTAAAAAA
1
1 12

output:

ATGC

result:

ok single line: 'ATGC'

Test #14:

score: 0
Accepted
time: 2ms
memory: 3436kb

input:

GGGGGGAAAAAA
1
1 12

output:

AGTC

result:

ok single line: 'AGTC'

Test #15:

score: 0
Accepted
time: 2ms
memory: 3404kb

input:

CCCCCCAAAAAA
1
1 12

output:

ACTG

result:

ok single line: 'ACTG'

Test #16:

score: 0
Accepted
time: 2ms
memory: 3288kb

input:

GGGGGGTTTTTT
1
1 12

output:

TGAC

result:

ok single line: 'TGAC'

Test #17:

score: 0
Accepted
time: 2ms
memory: 3288kb

input:

CCCCCCTTTTTT
1
1 12

output:

TCAG

result:

ok single line: 'TCAG'

Test #18:

score: 0
Accepted
time: 0ms
memory: 3368kb

input:

CCCCCCGGGGGG
1
1 12

output:

GCAT

result:

ok single line: 'GCAT'

Test #19:

score: 0
Accepted
time: 2ms
memory: 3308kb

input:

GGGGTTTTAAAA
1
1 12

output:

ATGC

result:

ok single line: 'ATGC'

Test #20:

score: 0
Accepted
time: 2ms
memory: 3372kb

input:

CCCCTTTTAAAA
1
1 12

output:

ATCG

result:

ok single line: 'ATCG'

Test #21:

score: 0
Accepted
time: 0ms
memory: 3432kb

input:

CCCCGGGGAAAA
1
1 12

output:

AGCT

result:

ok single line: 'AGCT'

Test #22:

score: 0
Accepted
time: 2ms
memory: 3288kb

input:

CCCCGGGGTTTT
1
1 12

output:

TGCA

result:

ok single line: 'TGCA'

Test #23:

score: 0
Accepted
time: 1ms
memory: 3368kb

input:

CCCGGGTTTAAA
1
1 12

output:

ATGC

result:

ok single line: 'ATGC'

Test #24:

score: 0
Accepted
time: 2ms
memory: 4000kb

input:

TGGTTAGAGGCGCCGACTTTCAGACGAATGTAAAGTGGAACCTCACTCCTATCGAAATAAGCAGAATCGGAGCTGGCTTGTTGGTCGAACGGAGCCCGTGTGCGGTCTTACGTAGCTCCATGAATCTGGGGATCAGGAGTGTGAACAGTCTCGGAAAACATACGTTGTTAATGTTGGCGACGTATGCCTATACCCAGCAGGCGACCAAGGGGGCAGACAAAGAGAATGGAGGGGCACCGTTACGCTTGAACGGCGACCGCGCTCGGAAACTCGAGTAGCCTTTGCGCATTACTTTTCAGT...

output:

GTCA
GATC
GACT
TGCA
AGCT
TGCA
TGCA
GACT
GCAT
CAGT

result:

ok 10 lines

Test #25:

score: 0
Accepted
time: 3ms
memory: 3916kb

input:

GGGTTCGTCCAAAGCCCAGACATATCTCCCCATGATCGCAGTCGGGATGGCTTAATTCTACGCTGTCGTTCTCAATATTATTTTCGCTCAGGACTCAACGGAATCCTGGCTGTATTCAACACGACAAAGAAGGTACCCCCGCTCTTCGATTCCTTGCTGACAACTTAGCCGGCCGGAAAGCGGCCTCCGGTCGTCAATCTTGCACCTGAAGGAAACCTATACCTGCTACCACGTATGATACTCTAATCTCATTTCGGCACTGTCGTTGTTAGTGTGTGTTGTTGCGACCTGGTGGTCGAA...

output:

CGTA
ATGC
CAGT
GCAT
CGAT
CAGT
ACGT
CGAT
CAGT
CGAT

result:

ok 10 lines

Test #26:

score: 0
Accepted
time: 3ms
memory: 3640kb

input:

AGCTTATCAAATACTGGCCCTAAGCTGATCCTTTAAGCGACAGTTTTGCCGACATTTACTCAAGACATCAGAGGACCGGCACAGGTCCACGCTGATTTCTAGGATACGATTCGGCCATCCGAAATAGATGTGTTACTAAGAGGGGGCCTTGGGTTCCACATGAAATCGGCGATTCCAATGAATAATAGGGACTTCCGAGATTCTCGCAGGGCAAGGGCAGAAAAACCTAAATGACCCCCAACCCTGCTAATTTCAGAACGATATGGTATCTCTACTGTATTAATCTACCGGACGCGAACT...

output:

ATGC
GTCA
GTCA
CGTA
ATCG
CGTA
CGTA
CGTA
GCTA
GACT

result:

ok 10 lines

Test #27:

score: 0
Accepted
time: 2ms
memory: 3364kb

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: 3424kb

input:

ATTTAGTTCTCGGTGGCTAAATCTGTATCACTGTTACACCTTCCAAATTAAATGAGCGCCGCTTTAGTCGATTTAATGGTATATCTAACAAACATTACCGCGGAGTTGCTACGGGGAAGGATAGCGTGCCAACCACCATGGCAGCACTAACAGTGCTCGGGAGTCGGACAGGGTAACTGTGCCAAATCCCGTCGTGTGCGTTTACATCCACCCCCCTGAACCGATTTAAGTGACCTTTATTTATCACGACCAACGCGTCTGCTCTGGGGCCCATTAAGCTGCAACGCGGATAGATGCTCC...

output:

TACG
TCAG
TAGC
TCAG
TGCA
ATCG
TCGA
TCAG
GACT
TGAC

result:

ok 10 lines

Test #29:

score: 0
Accepted
time: 3ms
memory: 3424kb

input:

TGCGTCCCCTGGCTAAGTGATAGGATAATCTCCATATCGCGTTGTATAGGATGCACTAAGTGTACCACAACACGATGCACCTGAGCATGAAGAAGTTGAGACTGAGTTATCGCAGAGAACTCGGCCTTTCTCCAGCCCGGCGTGCGAGAGGCACGACCGCAATATTTGACCCGCTGGTAACAGAAGACTTAGCTCCAAGGTGAGAACTGCCCTGGGATTAGTCCAGGGTGATTGTGCGCCCTCCACCCGACCCGCATTTCGTCAAATGGACGTAACACATTAACATTTGGTGACGGCCAA...

output:

TCGA
TCGA
TCGA
TCGA
TGCA
TGCA
TCGA
CTGA
TACG
TCGA

result:

ok 10 lines

Test #30:

score: 0
Accepted
time: 2ms
memory: 3544kb

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: 3728kb

input:

AGGTTATGCCCACGAAGTCCAGATGTGCTCAGTACGCATCATACGCTCGCTCGGGCCTTTGGTTCCACGCGGACGTCATCTTGTGCGGGGAGTAAAGTTATCTTTTCCCGTCTTCGTTACACGTACCATTCGGCCCACTTGTACTGCGGCATCCATCTGGAAAATGTACCGGGAGCAAACTATGGGGATCGGCCCCGACTTCATCCCCCGGGTAGGGCACACTCCAGTAGCAGAGGGTACCCTCGGCGCATCCACAATAGTCGGTCCCGACGTTACGGGACGGCATCCTGTCCCATCATA...

output:

CGTA
TCGA
TGCA
CAGT
TGCA
GCAT
CGTA
CGTA
CGTA
CGAT

result:

ok 10 lines

Test #32:

score: 0
Accepted
time: 2ms
memory: 3532kb

input:

TCGATACATTTATGTTTGCCGTCTTACTCCCCTCTGGTGTCCGTTCGATCGGGGATCGTCACTTGTTCTGCTAAAGAGTCTCGGGATTGGTTGAAAGTACAGCTCAGGTGTAACTAGTGGCCGGCTCGAGATAACTGCCAAATCTCTATTCCCTTGACAACTCACTAAGACAAGTTAACGGGACGTACGCGAGTATGCACAGTTAATGATTACCGGAAACGAATCTGTCCCAGACCGGCCCGATCGAACTTAAAGTGCGAATACGTAATAATTCTTACCTTTCAGGGTTATTGGATCTGA...

output:

ATCG
ATGC
TAGC
GCTA
GATC
GACT
CGAT
TGAC
GTAC
GATC

result:

ok 10 lines

Test #33:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

ACTCGACAATTAGAGTCTAATAGACCGGGACAGAGTTGTGGACTAGAGACAAATCTAAAAGGCGTGTGCGCCCAGGGTTGCCTCCAGTCAGTCCGTGTCGTACCCTAGTAGCTCTAGCCAAGAATTCATTGTTGTGGCTTCACCTCGACAAGACGCCTTCCAAGATGCGGGTGTAATAGGATCGGGCACAATCGCTTTTCGGCTTGACAATCGGATAGAGCGTTGCTAGCCGGTCTGTCTGATCGATAACTACTTCGAAAAGCCCTACCAGGCGATGGGTGGTAATTTTTTAATATTCAA...

output:

ATCG
ATCG
AGCT
AGCT
ATCG
AGTC
AGTC
CGAT
GTCA
GCAT

result:

ok 10 lines