Mehak1404's blog

By Mehak1404, history, 6 weeks ago, In English

155A - I_love_\%username\%

include

using namespace std;

int main() { int n, arr[1001], min=10000, a=0, max=0,b=0; int c=0; cin>>n;

for (int i = 0; i < n; ++i) {
    cin>>arr[i];

    if (max<arr[i]){
        max=arr[i];
        a+=1;
    }    
    if(min>arr[i]){
        min=arr[i];
        b+=1;
    }
}
c=a+b-2;

if(a+b==n && max!=min){
    cout<<(n-1)<<endl;
}
else{
    if(c<0 ){
        cout<<"0"<<endl;
    }
    else{
        cout<<c<<endl;
    }
}
cout<<a<<" "<<b<<endl;

return 0; }

 
 
 
 
  • Vote: I like it
  • -7
  • Vote: I do not like it

»
6 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Mehak1404 (previous revision, new revision, compare).