My issue
There is a 9th test case which was not there in the contest ans my solution fails on the 9th test case help needed
My code
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long int
#define double long double
#define MAX LLONG_MAX
#define MIN LLONG_MIN
#define endl '\n'
#define vin(a) for(int i=0;i<(a).size();i++)cin>>a[i];
#define vout(a) for(int i=0;i<a.size();i++)cout<<a[i]<<' ';cout<<endl;
#define cout(x) cout<<setprecision(20)<<x<<endl
const int M = 1e9+7;
const int N = 1e5+10;
void precalc(){}
void solve(){
int n;
cin >> n;
vector<int> v(n);
vector<int> ans(n);
vin(v);
vin(ans);
for(int i=0 ; i<n-3 ; i++){
if(v[i]!=ans[i]){
int a = v[i+3];
int b = v[i+2];
int c = v[i+1];
int d = v[i];
v[i]=b+c+d;
v[i+1]=b*-1;
v[i+2]=c*-1;
v[i+3]=a+b+c;
}
if(v[i]!=ans[i]){
cout << "NO" << endl;
return;
}
}
for(int i=0;i<n;i++){
if(v[i]!=ans[i]){
cout << "NO" << endl;
return;
}
}
cout << "YES" << endl;
}
int32_t main(){
fastio();
precalc();
int t;
cin >> t;
while(t--){
solve();
}
return 0;
}
Problem Link: Operating on A Practice Coding Problem - CodeChef