Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4.  
  5. ifstream fin("izolate.in");
  6. ofstream fout("izolate.out");
  7.  
  8. bool v[102];
  9.  
  10. int main()
  11. {
  12. int n, st ,dr, nr = 0;
  13. fin >> n;
  14. while(fin >> st >> dr)
  15. {
  16. if(!v[st])
  17. {
  18. v[st] = true;
  19. nr++;
  20. }
  21. if(!v[dr])
  22. {
  23. v[dr] = true;
  24. nr++;
  25. }
  26. }
  27. fout << n - nr << ' ';
  28. for(int i = 1; i <= n; i++)
  29. if(!v[i])
  30. fout << i << ' ';
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement