QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#47337 | #4669. Genetic Modifications | aurelion_sol | WA | 5ms | 4428kb | C++14 | 661b | 2022-09-08 09:34:26 | 2022-09-08 09:34:28 |
Judging History
answer
#include<bits/stdc++.h>
#define rp(i,a,b) for(int i=a,_=b;i<=_;++i)
#define pr(i,a,b) for(int i=a,_=b;i>=_;--i)
const int N=1e5+10;
int n,m,m2,mnl[N],p[N];
char s[N],t[N];
inline bool ok(int l,int r){return l>=mnl[r];}
void print(int o){
puts(o?"YES":"NO");
if(o)rp(i,1,m)printf("%d%c",p[i]," \n"[i==m]);
exit(0);
}
int main(){
scanf("%s%s",s+1,t+1);
n=strlen(s+1),m=strlen(t+1);
rp(i,1,n)mnl[i]=s[i]==s[i-1]?mnl[i-1]:i;
rp(i,1,n)if(s[i]==t[p[0]+1])p[++m2]=i,++p[0];
if(m2<m)print(0);
p[m+1]=n+1;
pr(i,m,0){
if(ok(p[i]+1,p[i+1]-1))print(1);
if(!i)print(0);
p[i]=mnl[p[i+1]-1];
if(s[p[i]]!=t[i])--p[i];
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3764kb
input:
BBAAABBAAABAAA BAAB
output:
YES 2 5 8 11
result:
ok good solution
Test #2:
score: 0
Accepted
time: 2ms
memory: 3696kb
input:
ABABABABAB ABAB
output:
NO
result:
ok no solution
Test #3:
score: 0
Accepted
time: 3ms
memory: 3972kb
input:
BBAAAAABBAAAAAABBABAABBBBBAABBBAAABABBABABBBAAABBAAAABBBBBABAABBBAABBBBBBBABBABABBAAAABBAAAABAAAABBABAAAAAAABBBBAAAAAABAABABBAAAAABBBBAABABABAAAAABBBABABBAABABBBBAABAABBBBBABBABABBAAABBAAAABBBABBABAAAABBBAABAAABBBAAAAAAAAAAAAABABBAABBBBABABAABBBBABAABBAAABABBBBAAAAAAAABBAAAABBABABABBBAAABAABBABBAAAA...
output:
NO
result:
ok no solution
Test #4:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
BABABAABABBABAAAAABAABBAAAAABABABBABABBBBBBBAAAAAAABAAAAABAABBABBABABBBABBBAAAABBBABABBAAAABBBAABBBBBBBAAAABAAAABBBBABBAABAABBBAABBBBABAABABBBBAABABBABBAABAABBBBBAAABBAABABBBBAABABBABAABAAAABBABABAABBBABBBBABABABABAAABBABABABABBABAABBBBABAABBABBBBABABBABBBBBAABBBBBAAABAABAAAABBBBBABBABABABBBBABBBABA...
output:
YES 1 2 4 5 6 8 9 10 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 61 63 64 66 67 69 70 71 72 73 74 75 76 77 78 79 80 81 83 85 86 87 88 89 90 91 92 95 96 97 98 99 100 101 102 104 105 106 107 108 109 110 11...
result:
ok good solution
Test #5:
score: 0
Accepted
time: 1ms
memory: 4168kb
input:
BAABBBBBBAAABABABAAAAABAABBAAABBAABBBAABABBBABBABBBABBBBABAABAAAAABBBBBBBABABABAABABAABAABBBBBBABABABABBABBBBAABAABBAAABABBAAAAAAABBAAAAAAAABAAABABBAAABABABBBABAAABBBAABAABBABBBBBBBBBABBBABBBABBAABAABBABABBBBAAAABABAABAABABBABBABBBBBAABABABBBBBABAABBABABAABBABAABABBBBABABBBBBBABBBABABBAAABBAAABBABBA...
output:
NO
result:
ok no solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 4116kb
input:
BBAABBAAABBBBAAABABBBABBBAABABAABBBABABBBAABBBBBBABBBAABABBBAAAAABABBABAABBAABABAABBAAABBBABAABBBAABAABABABBBBAABBBBBBBBBBBABBABABABBABBAAAAAAABAABABAABBABBABABBBBBAABBABBAABAABBBABBABBAABBBAAABBAAABABBBBBAAAABBAAABBAABABBABAABBBBAABBBAAAAAABBBAAAAABBBAAAABAABAAABBBAAABABBBABBBBBBBBAABABBABBBABAABAA...
output:
NO
result:
ok no solution
Test #7:
score: 0
Accepted
time: 3ms
memory: 3872kb
input:
BABBBBAABAAAAAABAAAAAABBABBABABAAABAAABAAAAABABAABABAABBBAAAABABBABAAABBBABAABBAABBBAABABBBABBBBBAAAABBAAABBBABBABBBAAABAABABABBABABABABBBAABABABAABBBBBAABAABBABAABABBBBBAABBAABABBAAABAAABABBBABABBBBAAABAABBBAABAABABBAABABAAAAABBBBAABABBBBBBABBBBBABBBABABBBAAAAAAABBAABAAAABAAAABBAABAABAABAABBBABBBAB...
output:
YES 1 2 3 7 8 10 11 16 17 18 19 23 24 26 27 29 30 31 32 33 35 36 37 38 40 41 45 47 48 50 51 53 54 58 62 64 66 67 68 69 71 72 74 76 78 80 82 85 86 87 88 89 92 93 94 95 96 98 99 102 104 105 107 108 109 111 112 114 117 118 119 121 123 124 125 126 127 129 130 132 133 134 135 136 137 139 140 141 142 143 ...
result:
ok good solution
Test #8:
score: 0
Accepted
time: 2ms
memory: 4204kb
input:
AABABBAAAAABBAAAAABBBAAAAABBAABBBBBABBABABBAAAABAAABAABAAABBABBABBABAABBBBBBBAABABBBBBAAABABABABBBAABABABAAAAABBAABAABAABABABABBAABBBAABAABBAAAABBBBBBBBABBBBABAAAABAABBABABAAABABABBBAAABAAAABBBAAABBBAAABABBBAAABBBAAABBBBABAABAAABABAABABBAAAABBBAAABBBAABAAABABABBBBAABBABABBBBAAABAABBBBABBAABBBAAAABAA...
output:
NO
result:
ok no solution
Test #9:
score: 0
Accepted
time: 5ms
memory: 4428kb
input:
BBAAAAAABAAABBBAABABABAABABAAABABAAAAABBBAAAABBABBABAAABABAAAABBAABBBBBBBAABABABBBBABBABAABBBABAAAABBABABBBAABBAABBBABBABBAABBBAAABBABABAAAAAABBBABBBAABAAAABAAAABAAABAAAAAAABAAAAABBABBBAAAAABBBAAABBBABBBBBAAABBAABAAABAAABBBAABBABBAABAAABBAAABAAAAABAAABBBABAAABABAAAAAAAABBBAAAAAABAAABAAABBABABBABABBA...
output:
YES 1 3 4 5 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 26 27 28 29 30 31 32 34 35 36 39 40 41 42 43 44 46 47 49 51 52 53 54 55 56 57 58 59 60 61 62 63 65 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 87 88 89 90 91 92 93 94 95 96 97 100 101 102 103 104 105 106 108 110 111 114 115 ...
result:
ok good solution
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 4296kb
input:
BABBABBABBBAAABABBBBAAAABBBABBBAABBAAAAABBBBABBBAABAAAAAABAABAABABABBABABBBBBBBAAABAABABBBBABBAABBAAAABBBAAABAABBBBAABABBABBABBABAAAAABBABABBABBABBAABABBABBBBBAAAABABABAABAAABABBBAABBAAABAABBBBABAABBBBBBABBABAABBAAABBBBBBAABABABABAAABAABBAABAABABAABBBBBBBBABABABBBABABBBABABAAAAABBBBBAAAAAAABBBBABABA...
output:
YES 1385 1386 1390 1392 1399 1401 1402 1404 1407 1410 1413 1415 1417 1420 1423 1428 1431 1435 1437 1439 1440 1443 1446 1448 1449 1450 1451 1453 1457 1465 1468 1471 1477 1479 1483 1485 1487 1489 1491 1494 1497 1499 1500 1502 1504 1506 1511 1516 1518 1521 1524 1526 1527 1530 1532 1536 1538 1540 1541 1...
result:
wrong answer wrong solution [2]