https://i0.wp.com/eblogarithm.com/wp-content/uploads/2017/07/Codeforces-Round-422-Div-2-problem-B-Crossword-solving-Solution-In-CC1.png?fit=640%2C360

Codeforces Round #422 (Div. 2), problem: (B) Crossword solving Solution In C/C++

#include<bits/stdc++.h>
using namespace std;
int n,m,i,j,c,a=2e9,ai;

string s,t;
int main(){
cin>>n>>m>>s>>t;
for(i=0;i<=m-n;i++)
{
for(c=j=0;j<n;j++)
t[i+j]==s[j]?0:c++;
c<a?a=c,ai=i:0;
}
cout<<a<<endl;
for(c=j=0;j<n;j++)
t[ai+j]!=s[j]?cout<<j+1<<” “,0:0;
}

(Visited 40 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: