Daffodil International University
Problem Link
//Please follow from main function
#include<bits/stdc++.h>
using namespace std;
int arr[100000000];
int main()
{
int n, low, high, l=0, h=0;
cin>>n;
for(int i=0; i<n; i++) cin>>arr[i];
low=arr[0];
high=arr[0];
for(int i=1; i<n; i++){
if(arr[i]<low && arr[i]<high){
low=arr[i];
l++;
}
else if(arr[i]>high && arr[i]>low){
high=arr[i];
h++;
}
}
cout<<h<<" "<<l<<endl;
return 0;
}
0 Comments