Guest User

Untitled

a guest
Jan 10th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. #include "/Users/the_sun/stdc++.h"
  2. //#include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. ifstream in("input.txt");
  7. ofstream out("output.txt");
  8.  
  9. #define pub push_back
  10. #define pob pop_back
  11. #define F first
  12. #define S second
  13. #define PI acos(-1)
  14.  
  15. typedef long long ll;
  16.  
  17. const int MAXN = 1e9;
  18. const ll MAXL = 1e18;
  19. const int N = 1e7;
  20. const long double eps = 1e-11;
  21.  
  22. struct kek{
  23. bool list, root;
  24. kek() {
  25. list = true;
  26. root = true;
  27. }
  28. };
  29.  
  30. int main() {
  31. ios_base::sync_with_stdio(0);
  32. cin.tie(0);
  33. int n, m;
  34. cin >> n >> m;
  35. vector<kek> v(n);
  36. int ans = n;
  37. for (int i = 0; i < m; ++i) {
  38. int from, to;
  39. cin >> from >> to;
  40. from--;
  41. to--;
  42. if (!v[to].root);
  43. else if (v[from].list) {
  44. v[from].list = false;
  45. v[to].root = false;
  46. ans--;
  47. }
  48. cout << ans << " ";
  49. }
  50. return 0;
  51. }
  52.  
  53. /*
  54. 3 3
  55. 1 2
  56. 1 3
  57. 2 3
  58.  
  59. 5 4
  60. 1 2
  61. 2 3
  62. 4 2
  63. 2 5
  64.  
  65. 4 4
  66. 1 2
  67. 1 2
  68. 3 4
  69. 3 4
  70. */
Advertisement
Add Comment
Please, Sign In to add comment