29852023-02-07 12:07:34samatEmezen Rt.cpp11Compilation error
#include <bits/stdc++.h>

using namespace std;



int n, m, db = 0, t;

void melysegi(vector< vector<int> >& v, vector<bool>& lattam, vector<int>& jelzes, int csucs, int allapot){

    if(!lattam[csucs]){

        lattam[csucs] = true;

        jelzes[csucs] = allapot;

        for(int i = 0; i < v[csucs].size(); i++){

            melysegi(v, lattam, jelzes, v[csucs][i], allapot * (-1));
        }

    }
    else{
        if(jelzes[csucs] == allapot * (-1)){
            db++;
        }
    }



}

void beolvas(vector< vector<int> >& v, ifstream& cin){


    cin >> n >> m;

    for(int i = 1; i <= m; i++){
        int x, y;
        cin >> x >> y;

        v[x].push_back(y);
        v[y].push_back(x);
    }


}

int main()
{
    //ifstream cin("elod.txt");

    cin >> t;

    while(t){

        vector< vector<int> > v(100000);

        vector<bool> lattam(100000, false);

        vector<int> jelzes(100000, 2);

        beolvas(v, cin);

        melysegi(v, lattam, jelzes, 1, 1);

        if(db > m / 2){
            cout << -1 << "\n";
        }
        else{

            int db2 = 0;

            for(int i = 1; i <= n; i++){
                if(jelzes[i] == 1){
                    db2++;
                }
            }

             cout << db2 << "\n";

            for(int i = 1; i <= n; i++){
                if(jelzes[i] == 1){
                    cout << i << " ";
                }
            }

            cout << "\n";

        }
        db = 0;

        t--;
    }



    return 0;
}
Compilation error
exit status 1
main.cpp: In function 'int main()':
main.cpp:63:20: error: invalid initialization of reference of type 'std::ifstream&' {aka 'std::basic_ifstream<char>&'} from expression of type 'std::istream' {aka 'std::basic_istream<char>'}
   63 |         beolvas(v, cin);
      |                    ^~~
main.cpp:33:50: note: in passing argument 2 of 'void beolvas(std::vector<std::vector<int> >&, std::ifstream&)'
   33 | void beolvas(vector< vector<int> >& v, ifstream& cin){
      |                                        ~~~~~~~~~~^~~
Exited with error status 1