QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#246270 | #4669. Genetic Modifications | Sham_Devour | WA | 2ms | 4760kb | C++14 | 992b | 2023-11-10 18:12:37 | 2023-11-10 18:12:37 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
char s[N],t[N];
int n,m,A,B;
int L[N],R[N];
vector<int> Lv,Rv,vec;
int main() {
scanf("%s%s",s+1,t+1);s[0]=s[1],s[n+1]=s[n];
n=strlen(s+1);m=strlen(t+1);
for(int i=1;i<=n;i++) {
L[i]=L[i-1];
if(L[i]==-1) continue;
if(L[i]==m&&s[i]!=s[i+1]) L[i]=-1;
if(t[L[i]+1]==s[i]) {
L[i]++;
Lv.push_back(i);
}
}
for(int i=n;i>=1;i--) {
R[i]=R[i+1];
if(R[i]==-1) continue;
if(R[i]==m&&s[i]!=s[i-1]) R[i]=-1;
if(s[i]!=s[i-1]&&s[i]==t[m-R[i]]) {
R[i]++;
Rv.push_back(i);
} else if(s[i]!=s[i+1]&&t[m-R[i]]==s[i]&&(Rv.size()&&Rv.back()!=i+1)) {
R[i]++;
Rv.push_back(i);
}
}
for(int i=0;i<n;i++)
if(L[i]!=-1&&R[i+1]!=-1&&L[i]+R[i+1]==m) {
puts("YES");
for(auto x:Lv)
if(x<=i) vec.push_back(x);
for(auto x:Rv)
if(x>i) vec.push_back(x);
sort(vec.begin(),vec.end());
for(auto x:vec) printf("%d ",x);
return 0;
}
puts("NO");
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3892kb
input:
BBAAABBAAABAAA BAAB
output:
YES 2 5 8 11
result:
ok good solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
ABABABABAB ABAB
output:
NO
result:
ok no solution
Test #3:
score: 0
Accepted
time: 1ms
memory: 4192kb
input:
BBAAAAABBAAAAAABBABAABBBBBAABBBAAABABBABABBBAAABBAAAABBBBBABAABBBAABBBBBBBABBABABBAAAABBAAAABAAAABBABAAAAAAABBBBAAAAAABAABABBAAAAABBBBAABABABAAAAABBBABABBAABABBBBAABAABBBBBABBABABBAAABBAAAABBBABBABAAAABBBAABAAABBBAAAAAAAAAAAAABABBAABBBBABABAABBBBABAABBAAABABBBBAAAAAAAABBAAAABBABABABBBAAABAABBABBAAAA...
output:
NO
result:
ok no solution
Test #4:
score: 0
Accepted
time: 1ms
memory: 4004kb
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: 2ms
memory: 4568kb
input:
BAABBBBBBAAABABABAAAAABAABBAAABBAABBBAABABBBABBABBBABBBBABAABAAAAABBBBBBBABABABAABABAABAABBBBBBABABABABBABBBBAABAABBAAABABBAAAAAAABBAAAAAAAABAAABABBAAABABABBBABAAABBBAABAABBABBBBBBBBBABBBABBBABBAABAABBABABBBBAAAABABAABAABABBABBABBBBBAABABABBBBBABAABBABABAABBABAABABBBBABABBBBBBABBBABABBAAABBAAABBABBA...
output:
NO
result:
ok no solution
Test #6:
score: 0
Accepted
time: 2ms
memory: 4636kb
input:
BBAABBAAABBBBAAABABBBABBBAABABAABBBABABBBAABBBBBBABBBAABABBBAAAAABABBABAABBAABABAABBAAABBBABAABBBAABAABABABBBBAABBBBBBBBBBBABBABABABBABBAAAAAAABAABABAABBABBABABBBBBAABBABBAABAABBBABBABBAABBBAAABBAAABABBBBBAAAABBAAABBAABABBABAABBBBAABBBAAAAAABBBAAAAABBBAAAABAABAAABBBAAABABBBABBBBBBBBAABABBABBBABAABAA...
output:
NO
result:
ok no solution
Test #7:
score: 0
Accepted
time: 1ms
memory: 4036kb
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: 4760kb
input:
AABABBAAAAABBAAAAABBBAAAAABBAABBBBBABBABABBAAAABAAABAABAAABBABBABBABAABBBBBBBAABABBBBBAAABABABABBBAABABABAAAAABBAABAABAABABABABBAABBBAABAABBAAAABBBBBBBBABBBBABAAAABAABBABABAAABABABBBAAABAAAABBBAAABBBAAABABBBAAABBBAAABBBBABAABAAABABAABABBAAAABBBAAABBBAABAAABABABBBBAABBABABBBBAAABAABBBBABBAABBBAAAABAA...
output:
NO
result:
ok no solution
Test #9:
score: -100
Wrong Answer
time: 2ms
memory: 4520kb
input:
BBAAAAAABAAABBBAABABABAABABAAABABAAAAABBBAAAABBABBABAAABABAAAABBAABBBBBBBAABABABBBBABBABAABBBABAAAABBABABBBAABBAABBBABBABBAABBBAAABBABABAAAAAABBBABBBAABAAAABAAAABAAABAAAAAAABAAAAABBABBBAAAAABBBAAABBBABBBBBAAABBAABAAABAAABBBAABBABBAABAAABBAAABAAAAABAAABBBABAAABABAAAAAAAABBBAAAAAABAAABAAABBABABBABABBA...
output:
NO
result:
wrong answer you didn't find a solution but jury did