April Lunchtime 2020 1st problem help

This was my solution, it worked perfectly fine in my editor but was showing runtime error (SIGSEGV). I tried my best to find out what is wrong in my code but failed. Please if anyone can figure out what is the issue.

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n, s, input;
        cin >> n >> s;

        vector<int> p;
        vector<int> c;
        vector<int> d;
        vector<int> f;

        for (int i = 0; i < n; i++)
        {
            cin >> input;
            p.push_back(input);
        }
        for (int i = 0; i < n; i++)
        {
            cin >> input;
            c.push_back(input);
        }
        for (int i = 0; i < n; i++)
        {
            if (c[i] == 0)
                d.push_back(p[i]);
            else
                f.push_back(p[i]);
        }

        sort(d.begin(), d.end());
        sort(f.begin(), f.end());

        if ((d.front() + f.front() + s) > 100)
            cout << "no\n";
        else
            cout << "yes\n";
    }
}

This is because it is not necessary that d.size()>0 and f.size()>0.
there can be a ā€œcā€ vector where all elements are 0 .

1 Like

thank you brother