Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "/Users/the_sun/stdc++.h"
- //#include <bits/stdc++.h>
- using namespace std;
- ifstream in("input.txt");
- ofstream out("output.txt");
- #define pub push_back
- #define pob pop_back
- #define F first
- #define S second
- #define PI acos(-1)
- typedef long long ll;
- const int MAXN = 1e9;
- const ll MAXL = 1e18;
- const int N = 1e7;
- const long double eps = 1e-11;
- struct kek{
- bool list, root;
- kek() {
- list = true;
- root = true;
- }
- };
- int main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- int n, m;
- cin >> n >> m;
- vector<kek> v(n);
- int ans = n;
- for (int i = 0; i < m; ++i) {
- int from, to;
- cin >> from >> to;
- from--;
- to--;
- if (!v[to].root);
- else if (v[from].list) {
- v[from].list = false;
- v[to].root = false;
- ans--;
- }
- cout << ans << " ";
- }
- return 0;
- }
- /*
- 3 3
- 1 2
- 1 3
- 2 3
- 5 4
- 1 2
- 2 3
- 4 2
- 2 5
- 4 4
- 1 2
- 1 2
- 3 4
- 3 4
- */
Advertisement
Add Comment
Please, Sign In to add comment