TOPIC

Wrong Answer 100%

Renzo Vicente Castro asked 2 years ago

include <bits/stdc++.h>

using namespace std;

int main() { int n; cin>>n; vectorA(n); vectorP; vectorI; if(n>1 && n<100000) {

 for(int i=0;i<n;i++)
{
    cin>>A[i];
}
for(int j=0;j<n;j++)
{
    if(A[j]%2==0 && A[j]>=0)
    {

        P.push_back(A[j]);

    }
    else if(A[j]%2!=0 && A[j]>=0)
    {
        I.push_back(A[j]);
    }

}
sort(P.begin(),P.end());
for(int k=0;k<P.size();k++)
{

    cout<<P[k]<<endl;
}
 sort(I.begin(),I.end());
for(int l=I.size()-1;l>=0;l--)
{

    cout<<I[l]<<endl;
}

}

}

This topic has not been answered yet. Be the first!

Remember not post solutions. Your post may be reviewed by our moderators.