WDTBAM - Editorial

Bro the array W holds N+1 values i.e., W0,W1,… all the way upto WN.
so correct the array size to W[N+1].

#include
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
// your code goes here
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
ll int ans=0;
string crt;
string given;
cin>>crt>>given;
for(int i=0;i<n;i++)
{
if(crt[i]==given[i])
{
ans++;
}
}

    ll int res=0;
    for(int i=0;i<=n;i++)
    {
        ll int w;
        cin>>w;
        if(i<=ans)
        {
            res=max(res,w);
        }
        
    }
    cout<<res<<endl;
}
return 0;

}

what’s mistake in this