Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int surow[1000005], zapotrz[1000005], t[1000005];
- int x=0, n;
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin>>n;
- for (int i=1; i<=n; i++)
- {
- cin>>surow[i];
- cin>>zapotrz[i];
- }
- for (int i=1; i<=n; i++)
- {
- t[zapotrz[i]]=i;
- }
- for (int i=1; i<=n; i++)
- {
- if (t[i+1]<t[i]) x++;
- }
- cout<<x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement