jakaria_hossain

codeforce - I_love_%username%

Mar 29th, 2019
263
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 fastread()(ios_base::sync_with_stdio(false),cin.tie(NULL));
  4. int main()
  5. {
  6. int n,mx,mn,cnt=0,x;
  7. cin>>n;
  8. for(int i=0;i<n;i++)
  9. {
  10. cin>>x;
  11. if(i==0)
  12. {
  13. mn=x;
  14. mx=x;
  15. }
  16. else
  17. {
  18. if(x>mx||x<mn)
  19. {
  20. cnt++;
  21. mx=max(mx,x);
  22. mn=min(mn,x);
  23. }
  24. }
  25. }
  26. cout<<cnt<<endl;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment