I found a weird thing in today’s lunch time.
My code was giving RE(SIGSEGV) .I was just doing simple push_back and min_element operation on vectors.
Please help me If you can find any error
It’s working perfect on my machine
Here is my solution.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long int lt;
typedef vector vi;
typedef vector vin;
typedef pair<ll,ll> pll;
typedef pair<int,int> pin;
#define all(a) a.begin(),a.end()
#define rep(i,a,b) for(int i=a;i<b;++i)
#define f(i,b) for(int i=0;i<b;++i)
#define per(i,a,b) for(int i=a;i>=b;–i)
#define test(t) int t; cin>>t; while(t–) solve()
#define endl “\n”
#define p1 cout<<“YES”<<endl
#define p0 cout<<“NO”<<endl
#define fst ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
const int mod=1e9+7;
ll mod_pow(ll a,ll n,ll mod) //(a^n)%mod
{ ll res=1;
while(n){ if(n&1) res=(resa)%mod; n/=2; a=(aa)%mod; }
return res;
}
void solve();
int main()
{
fst;
test(t);
//solve();
}
/**********************<=“Actual code strats here”=>*****************************/
void solve()
{
ll n,s;
cin>>n>>s;
vector v(n);
rep(i,0,n) cin>>v[i];
vector<int> x,y;
rep(i,0,n)
{
int t;
cin>>t;
if(t) x.push_back(v[i]);
else y.push_back(v[i]);
}
int l=*min_element(all(x)),lk=*min_element(all(y));
if(s+l+lk<=100)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
I have wasted my 15 min because of this.