Advertisement
Singasking

Untitled

Oct 4th, 2022
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int N = 10e3;
  4. vector<int> adj[N];
  5. int main() {
  6. int V;
  7. cin>>V;
  8. for(int i=0;i<V;i++) {
  9. for(int j=0;j<V;j++) {
  10. int x;
  11. cin>>x;
  12. if(x==1) {
  13. adj[i].push_back(j);
  14. }
  15. }
  16. }
  17. vector<int> list;
  18. for(int i=0;i<V;i++) {
  19. if(adj[i].size()%2!=0) { list.push_back(i);}
  20. }
  21. if(list.empty()) {
  22. cout<<-1<<endl;
  23. } else {
  24. for(auto x:list) { cout<<x<<endl; }
  25. }
  26. }
  27.  
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement