ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#211131 | #3799. 猫哭 | shiruiheng | 0 | 707ms | 26144kb | C++11 | 1.7kb | 2024-08-09 12:00:58 | 2024-08-09 12:55:09 |
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
//using LL = __int128
#define pi pair<ll, ll>
#define N 1111111
ll m, v[N], vis[N], pre[N], mp[1111], tr[1111] = {' ', 'T', 'A', 'C'}, n, pos, ans, t[4];
char c[N];
queue<int> q[4];
int main(){
mp['T'] = 1;
mp['A'] = 2;
mp['C'] = 3;
scanf("%lld", &m);
while(m--){
for(int i = 0 ; i < 4 ; i++){
while(q[i].size())
q[i].pop();
t[i] = 0;
}
scanf("%s", c + 1);
n = strlen(c + 1);
for(int i = 1 ; i <= n ; i++)
pre[i] = i, vis[i] = 0;
pos = ans = 0;
for(int i = 1 ; i <= n ; i++)
if(mp[c[i]])
v[++pos] = mp[c[i]];
n = pos;
reverse(v + 1, v + 1 + pos);
for(int i = 1 ; i <= n ; i++){
if(v[i] == 1){
q[0].push(i);
}
else if(v[i] == 2){
if(q[0].size()){
pre[i] = q[0].front();
q[0].pop();
q[1].push(i);
}
}
else{
if(q[1].size()){
vis[q[1].front()] = vis[pre[q[1].front()]] = vis[i] = true;
ans++;
q[1].pop();
q[2].push(i);
}
}
/*
printf("%lld:%lld %lld %lld %lld\n", v[i], t[0], t[1], t[2], t[3]);
//*/
}
for(int i = 1 ; i <= n ; i++)
if(!vis[i]){
if(v[i] == 1){
if(t[1])
t[1]--, ans++;
else
t[0]++;
}
else{
if(t[0])
t[0]--, t[1]++;
}
}
/*
for(int i = 1 ; i <= pos ; i++)
printf("%lld%c", vis[i], " \n"[i == pos]);
for(int i = 1 ; i <= pos ; i++)
printf("%lld%c", v[i], " \n"[i == pos]);
//*/
printf("%lld\n", ans);
}
return 0;
}
/*
0:......T
1:......T A
2:......T A C
3:......T A T
4
CATAT
TACT
CACATT
CGGATACGAATCTCG
1
1
2
2
TATATT
TATATTATATTTAT
TA(T?)
TATTAATTT
TTTAATTAT
*/
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 1256kb
input:
40 CCCATGCA CCTATCAT GTCTGCTA ACACCTCC TTATAACA ATGATCAT TATTACCA CAAGCACC CTCTCCTC CTTTAAAT CACTTCC...
output:
1 2 1 1 1 2 1 0 1 1 1 1 2 1 1 1 1 1 2 1 0 1 2 0 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 0
result:
wrong answer 3rd words differ - expected: '0', found: '1'
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 1260kb
input:
40 GTACT CATCT ATAAT TCAGT ATTCG ACTTT TCCGA CACTA TGATC TGTCA AATAT AACCT TATCT TCCTC ATATG AGTCA C...
output:
1 1 1 1 0 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 0 0 0 1 0 1 0 0 1 1 1 1 0 1 1 1 1 1 0 1
result:
wrong answer 14th words differ - expected: '0', found: '1'
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 1260kb
input:
40 GCATTCTACCAGAGT TGGGTATAAATTTCT AAACCCTGTTTTTAC TCCCATCTCAATCTG CATCGCTTTAAACTT TACACGATTCATCAC T...
output:
2 3 0 4 3 3 3 2 1 3 3 3 3 3 3 3 3 3 2 1 4 3 3 1 1 1 2 2 3 2 2 3 2 3 2 4 3 2 2 3
result:
wrong answer 4th words differ - expected: '3', found: '4'
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 1260kb
input:
40 TAGACACTATCTTCC CCTATCCCATACAAT AGTCTTACCGCTCCA AGCTCAAATAAATCA GAACACCCCAAACAA ATACCAACTCATCAA C...
output:
3 3 1 2 0 2 3 4 1 1 3 2 3 3 2 3 3 3 3 3 2 2 2 1 3 2 3 2 2 2 3 2 3 1 3 3 2 1 3 3
result:
wrong answer 7th words differ - expected: '4', found: '3'
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 1256kb
input:
40 EJUPFQZTAJCKRQD UMDIIZLTKGXGUUY RNFTZBNKAYNSWZT KEGHKRLQWKXJFSI XZLUPCKNWHVBDZO LYBUUCYFIUGEECF Z...
output:
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
result:
wrong answer 39th words differ - expected: '0', found: '1'
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 1260kb
input:
10 TAATTCCTACCTCTATAATAATACCCCACCCTACATCAATCGAATTTCAA CACATAAATCCCCATCTAGTTCAGCTTTTTCTATAAACATAATATC...
output:
12 12 10 11 8 13 8 11 11 8
result:
wrong answer 1st words differ - expected: '11', found: '12'
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 1264kb
input:
10 ATATATCTGCTAGTCTTCGCCGCTACATAACGCTACTACGAATTGCAACC TGATATCCTTCCCTTAGTTTATCATTGATATTATCACACAAAAATT...
output:
10 12 11 11 12 11 13 10 10 12
result:
wrong answer 1st words differ - expected: '8', found: '10'
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 1264kb
input:
10 CGACGCCCTAACAAGCACGAACCTTTTTGCAACAGATATTCACAAATATG TTATACCTTCACACTTTACTACATACAGCACTCGAAAGAAAGATCA...
output:
11 10 11 12 10 8 11 9 10 9
result:
wrong answer 2nd words differ - expected: '9', found: '10'
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 1260kb
input:
10 GAACAAACCATTGAGTTCATTGCACATCCGATACCTAAAAAACACTACAT ACCCAGATCTACTCTCTTCTAACACTGATTGACAATTTGCTGAACC...
output:
9 10 11 10 5 11 11 11 8 13
result:
wrong answer 3rd words differ - expected: '9', found: '11'
Test #10:
score: 0
Wrong Answer
time: 0ms
memory: 1260kb
input:
19 GACTTACGCCCAAAAATCCCCGAGACGTCACTAAATCTCAAAAATTATTC CTTCTAAATCTAATCCTATGTCGCCCTCCGCTCTGGGACTATTCTC...
output:
9 12 7 10 3 2 4 4 3 5 4 4 4 4 4 4 2 3 6
result:
wrong answer 2nd words differ - expected: '9', found: '12'
Test #11:
score: 0
Wrong Answer
time: 0ms
memory: 1264kb
input:
19 TGCTTCCTGCATCGAAATGT CACAAGTGAAATTGTTTACT TGTTCAAACCAACCCTCTTC ACTCTACCTGTCGCCAAATA TGACACCTCATCG...
output:
5 3 3 3 4 4 4 5 2 3 4 2 3 3 3 9 11 13 10
result:
wrong answer 1st words differ - expected: '3', found: '5'
Test #12:
score: 0
Wrong Answer
time: 0ms
memory: 1256kb
input:
50 AAACAAATCT TCCCAACAAC TCTCAATTCC CTCCATCTAA GATAAACTCA ACTTACGTTA CTAATTCCCA CTCTCACTCA AATAATGCA...
output:
1 0 2 2 1 2 2 2 1 2 2 1 2 1 1 1 2 2 1 1 1 0 1 1 3 1 3 1 1 1 2 2 2 1 2 0 1 2 1 1 2 2 2 2 1 2 2 2 1 1
result:
wrong answer 4th words differ - expected: '1', found: '2'
Test #13:
score: 0
Wrong Answer
time: 0ms
memory: 1260kb
input:
10 DOEHWYGHXGOJAQHEFUFFVAKMLNHMOXSUZWMNATIULQZQMCWZJA NXJHYTEVCSYBGVASDYEQFCAYDXPYNDJQQJWLNJOWNOIWRX...
output:
0 0 0 1 0 0 1 0 1 2
result:
wrong answer 9th words differ - expected: '0', found: '1'
Test #14:
score: 0
Wrong Answer
time: 0ms
memory: 1304kb
input:
62 AAATTTTTTTTATTTATTATTTTTTTTAATAAATTATATAATATTTTTAATTATTTTTTATTAATTTTAATTATTAATTATATTAAATTTTATTTAT...
output:
323 318 14 13 12 9 12 13 13 12 12 13 15 12 10 14 11 14 15 10 12 15 12 12 13 10 11 15 12 14 15 7 15 1...
result:
wrong answer 1st words differ - expected: '329', found: '323'
Test #15:
score: 0
Wrong Answer
time: 0ms
memory: 1300kb
input:
5 TTATAATTTTTTTATTTTTTATTTATTTATTTAATATTTTTTATTTATTAAATATAATTTTTTATTTTTTTATTATTTAAATTTTTTATATAAAATAA...
output:
309 323 328 311 316
result:
wrong answer 1st words differ - expected: '313', found: '309'
Test #16:
score: 0
Wrong Answer
time: 0ms
memory: 1304kb
input:
5 TTATTATATTATTTTTTTATTAAATTATTTATATAAATAAATTATTTTTATTTTATTTTATTATTTTTATTTATTATTTTTTTATTTAAAAATTTTAT...
output:
311 307 311 309 330
result:
wrong answer 1st words differ - expected: '333', found: '311'
Test #17:
score: 0
Wrong Answer
time: 0ms
memory: 1304kb
input:
5 TAATTTATTTTATTTATTAAATTTTTATTTTAATAATATTTTAATTATTTATATTTTATTAATAATAATTTTTTTATTTAAATTTAATTATTTTTTTA...
output:
316 319 324 320 300
result:
wrong answer 1st words differ - expected: '323', found: '316'
Test #18:
score: 0
Wrong Answer
time: 0ms
memory: 1300kb
input:
5 TTTATTTTTTTTTATTTTTATTTATTTAATTTATAATATTATTTTTTTTATAATTTTTTTTTTTTTATAAAATATTTTTATTTTTTTAATATATTTTT...
output:
310 326 312 314 327
result:
wrong answer 1st words differ - expected: '324', found: '310'
Test #19:
score: 0
Wrong Answer
time: 0ms
memory: 1304kb
input:
62 ATTTTTTTATATTTTTTTTTTTTTATTTTTATTATTATTATTTTTATTTA ATTATATTTTATTAATTTTTAATTTTTTATTTTAATTTTAATTAAT...
output:
8 13 14 11 14 9 15 11 13 13 10 13 14 13 14 12 11 13 13 14 13 14 13 13 14 10 14 15 13 13 12 15 13 14 ...
result:
wrong answer 2nd words differ - expected: '15', found: '13'
Test #20:
score: 0
Wrong Answer
time: 1ms
memory: 1280kb
input:
110 TATTAAATATATTAAATTTTTTTTATTAATTTATTATTTATTATTATATTATATTTTTTATATTTTTATAAAAATTTATTTTATTTATAATTAATA...
output:
97 91 93 84 93 89 91 94 85 86 3 4 5 4 4 6 6 4 3 4 2 5 5 6 4 4 6 5 3 6 5 4 4 2 3 3 3 3 5 3 5 5 4 4 2 ...
result:
wrong answer 1st words differ - expected: '98', found: '97'
Test #21:
score: 0
Wrong Answer
time: 0ms
memory: 1280kb
input:
110 ATATATTTTTAATTTTTTAT TTTTTTTAATTTTTATTATT TTTATAAATAAAATTTTTTT AATATTTATAATAATTTTAT AAATTTATAATA...
output:
5 4 5 5 4 5 6 5 3 6 3 4 3 5 5 5 4 4 4 5 4 5 3 6 4 4 5 3 4 4 6 3 5 5 4 3 2 4 5 4 5 6 4 4 3 3 3 5 2 4 ...
result:
wrong answer 5th words differ - expected: '5', found: '4'
Test #22:
score: 0
Wrong Answer
time: 0ms
memory: 1272kb
input:
5 SXKKWHGPZMREKWJWXIEXUZXLQGVRPQKXQLASTFLUAPAPUSLGRPEINOXUBSXJLAQHQFNXPPBZZAJLXRIQTPNVJPJVAWXWINTTKO...
output:
17 14 17 22 17
result:
wrong answer 1st words differ - expected: '18', found: '17'
Test #23:
score: 0
Wrong Answer
time: 52ms
memory: 26144kb
input:
2 TATATACAACATCTAGATCTCACTTGATTTCACTATTCAATTCCCATGTCCATACAACCGACTCAAATTCTAATTTTAGATTTACTAACCCATTACCG...
output:
304732 304747
result:
wrong answer 1st words differ - expected: '304734', found: '304732'
Test #24:
score: 0
Wrong Answer
time: 45ms
memory: 26140kb
input:
2 CCTGTCTATCAACCTCTAACACATAATCGGACTATGACCACTTGATTTTACCACTACCAGCTCAAATGAACACACTCTCTTTTCTTATTACTATCAAC...
output:
305145 304997
result:
wrong answer 1st words differ - expected: '305146', found: '305145'
Test #25:
score: 0
Wrong Answer
time: 49ms
memory: 26140kb
input:
2 TACCAACCTACTCGAGCTCCCTCTACAATTACGACTTCCTGAACTACCATACCAAACTGCTCTCGAATTGTATCGACATGATTAAGTCCCAATTCGAT...
output:
304734 304927
result:
wrong answer 1st words differ - expected: '304736', found: '304734'
Test #26:
score: 0
Wrong Answer
time: 42ms
memory: 26140kb
input:
2 CACACATTCTCTCTTATTCAGCCTATCCGTGAAAGTTGACATATATCATGTCAAAATGCCATCTTAACTTAATAACGTAAATCTACCGATCCATTTAT...
output:
304586 305150
result:
wrong answer 1st words differ - expected: '304589', found: '304586'
Test #27:
score: 0
Wrong Answer
time: 57ms
memory: 8720kb
input:
84 ATAGACCCCCCAACACCGCTACTAACTTTCCCTGATTATCCCCTGGCATCTCCATTGTTAAAACGCCCCTATTACGTAATTTTTGCGCGATATTTTA...
output:
91063 91193 91101 90904 2948 2997 2959 2996 2991 2977 3007 2984 2974 3009 2984 2999 2979 2984 2989 2...
result:
wrong answer 1st words differ - expected: '91027', found: '91063'
Test #28:
score: 0
Wrong Answer
time: 38ms
memory: 8772kb
input:
84 CTCCTCACCTTTAACGATCATACTCAATAACAGAACACCATTCGACCCCCTTTAACCATATGCCACGCCTGACTATTTCACTTCCTCCCTTGCCGAT...
output:
2932 2959 2953 2940 2996 2997 2983 2995 2993 3001 2983 2995 2963 2915 2979 3007 3020 3028 2951 2983 ...
result:
wrong answer 1st words differ - expected: '2938', found: '2932'
Test #29:
score: 0
Wrong Answer
time: 64ms
memory: 26140kb
input:
10001 AAAGACGCTCCAACCAGCTATCTTTCCAAATGTTCCTCTACCCTACCTCAGCTTTCGTCCAATCCCAGAACCCTAGTTAATATAACTCTAAATA...
output:
304837 25 27 27 27 23 22 28 26 25 24 23 26 24 24 24 22 21 20 24 26 26 26 20 27 26 28 23 22 23 19 25 ...
result:
wrong answer 1st words differ - expected: '304838', found: '304837'
Test #30:
score: 0
Wrong Answer
time: 47ms
memory: 26144kb
input:
2501 CGTCCACGTTGTCGCCCACTATATAAACTATCTCCCACTATGAAAGGCCCCTTTTAATAACCTCATCTCTTAAAGATAAATCCCTAATTACCCTA...
output:
111 105 112 117 113 114 115 95 108 105 99 102 101 113 108 113 114 102 111 99 100 111 107 110 117 108...
result:
wrong answer 3rd words differ - expected: '108', found: '112'
Test #31:
score: 0
Wrong Answer
time: 98ms
memory: 1268kb
input:
100000 TAAATTTACTACTCCTACCA AACACATAAAACGCTTCTCA CATATCTAAAAATAAACCTC CGTCCCAACCTACCTCGCCT TACGACCCA...
output:
3 3 3 3 1 3 3 4 2 2 4 4 3 3 4 5 6 3 5 2 2 3 1 3 4 3 5 3 4 4 1 3 3 3 5 3 4 4 4 4 4 3 4 3 3 3 3 3 3 0 ...
result:
wrong answer 13th words differ - expected: '2', found: '3'
Test #32:
score: 0
Wrong Answer
time: 139ms
memory: 3784kb
input:
250005 TAGCAAATTTTACATAGCAATAATCACATAACTTACCTCATACTATAATAGAATCATTAACACCATGCCATCCCCTCTCATGTATACCTCTTT...
output:
30478 30423 30416 30362 30345 0 1 0 0 1 0 0 1 1 2 1 0 0 0 0 1 1 1 0 0 1 0 1 1 0 1 0 1 0 1 1 1 1 0 0 ...
result:
wrong answer 2nd words differ - expected: '30424', found: '30423'
Test #33:
score: 0
Wrong Answer
time: 52ms
memory: 26140kb
input:
1001 TAATACCTTCCCCCTTAATGAACCCATAGACCTTTCCCTTTAATAATTCTAATACAACCCTGGCCCCACACACAAATATAAACCAGGGTCAAAAA...
output:
284 270 281 296 285 268 278 285 284 279 286 284 288 279 279 288 283 296 283 278 290 291 298 283 291 ...
result:
wrong answer 2nd words differ - expected: '272', found: '270'
Test #34:
score: 0
Wrong Answer
time: 23ms
memory: 18908kb
input:
2 NPPZPXGAOITHNUMEIZSXQMQAZPYNBVBKYSJGJDMGEYQRYSPFBKJOJYIFRAJWFCQYOATYKHTBWXAKPVKFAXJBDBWIXDUBGRMGVG...
output:
37968 38409
result:
wrong answer 1st words differ - expected: '37993', found: '37968'