daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int surow[1000005], zapotrz[1000005], t[1000005];
  4. int x=0, n;
  5.  
  6. int main()
  7. {
  8.     ios_base::sync_with_stdio(0);
  9.  
  10.     cin>>n;
  11.  
  12.     for (int i=1; i<=n; i++)
  13.         {
  14.             cin>>surow[i];
  15.             cin>>zapotrz[i];
  16.  
  17.         }
  18.  
  19.     for (int i=1; i<=n; i++)
  20.         {
  21.             t[zapotrz[i]]=i;
  22.         }
  23.     for (int i=1; i<=n; i++)
  24.         {
  25.             if (t[i+1]<t[i]) x++;
  26.         }
  27.  
  28.     cout<<x;
  29.  
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top