My issue
can someone tell me why this give SIGSEGV error
My code
#include<bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(false), cin.tie(NULL);
using lld = long double;
using ll=long long;
int main() {
// your code goes here
fastio()
ll t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<ll>a,b;
for(int i=0;i<n;i++){
ll x;
cin>>x;
a.push_back(x);
}
for(int i=0;i<n;i++){
ll x;
cin>>x;
b.push_back(x);
}
vector<pair<ll,ll>>v;
for(int i=0;i<n;i++){
v.push_back(make_pair(a[i],b[i]));
}
sort(v.begin(),v.end());
vector<lld>time;
for(int i=0;i<n;i++){
ll x1=v[i].first;
ll x2=v[i].second;
time[i]=x1/(double)x2;
}
ll last_time=time[n-1];
ll ans=1;
for(ll i=n-2;i>=0;i--){
if(time[i]<last_time){
ans++;
last_time=time[i];
}
}
cout<<ans<<endl;
}
return 0;
}
Problem Link: Ball Game Practice Coding Problem