We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

I tried to implement your algorithm but I am getting half test cases as wrong answer. Can you help?

include

using namespace std;

int main() {
int n;
vectora;
cin>>n;
int u,temp1;
maph;
for(u=0;u>temp1;
a.push_back(temp1);
h[temp1]=u;
}
vectorb(a.begin(),a.end());
vectorc(a.begin(),a.end());
sort(b.begin(),b.end());
int count_a=0;
int count_b=0;
int i,j,sec;
for(i=0;i());
for(i=0;i

## Lily's Homework

You are viewing a single comment's thread. Return to all comments →

I tried to implement your algorithm but I am getting half test cases as wrong answer. Can you help?

## include

using namespace std;

int main() { int n; vectora; cin>>n; int u,temp1; maph; for(u=0;u>temp1; a.push_back(temp1); h[temp1]=u; } vectorb(a.begin(),a.end()); vectorc(a.begin(),a.end()); sort(b.begin(),b.end()); int count_a=0; int count_b=0; int i,j,sec; for(i=0;i()); for(i=0;i