Advertisement
Saleh127

cf 479C

Sep 3rd, 2020
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; while(t--)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. ll c,d,e,f,i,j,k,l=-100;
  11. cin>>c;
  12. pair<ll,ll>a[c];
  13. for(i=0;i<c;i++)
  14. {
  15. cin>>a[i].first>>a[i].second;
  16. }
  17. sort(a,a+c);
  18. for(i=0;i<c;i++)
  19. {
  20. if(l<=a[i].second)
  21. {
  22. l=a[i].second;
  23. }
  24. else l=a[i].first;
  25. }
  26. cout<<l<<endl;
  27. return 0;
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement