## ➤ Problem Link : 1333B. Kind Anton

## ✅ C++ Solution :

#include<bits/stdc++.h> using namespace std; #define ll long long int #define pb push_back #define mp make_pair int main() { int t; cin>>t; while(t--) { int n; cin>>n; int A[n]; int B[n]; for(int i=0;i<n;i++) cin>>A[i]; for(int j=0;j<n;j++) cin>>B[j]; int one=0; int neg=0; bool flag=1; for(int i=0;i<n;i++) { if(A[i]==B[i]) { if(A[i]==1) one++; if(A[i]==-1) neg++; continue; } if(B[i]> A[i]) { if(one==0) { flag=0; break; } if(A[i]==1) one++; if(A[i]==-1) neg++; continue; } else{ if(neg==0) { flag=0; break; } if(A[i]==1) one++; if(A[i]==-1) neg++; continue; } } if(flag) cout<<"YES\n"; else cout<<"NO\n"; } }

Thank you for your patience reading. If you enjoyed this post, I’d be very grateful if you’d help it spread by emailing it to a friend, or sharing it on Whatsapp or Facebook.

**ðŸ˜‡Happy Learning!!**