TAP2013G
#include <iostream>
#include<algorithm>
using namespace std;
int main() {
int s,count=0;
cin>>s;
int n[100001],q[100001];
for(int i=0;i<s;i++)
{
cin>>q[i];
}
for(int i=0;i<s;i++)
{
cin>>n[i];
}
sort(q,q+s);
sort(n,n+s);
for(int i=0,j=0;i<s&&j<s;)
{
if(q[i]<n[j])
{
count++;
i++;
j++;
}
else if(q[i]==n[j])
{
j++;
}
else
j++;
}
cout<<count<<endl;
return 0;
}
simple and easy problems , u only need to give victory any how to alogonia army.
#include <iostream>
#include<algorithm>
using namespace std;
int main() {
int s,count=0;
cin>>s;
int n[100001],q[100001];
for(int i=0;i<s;i++)
{
cin>>q[i];
}
for(int i=0;i<s;i++)
{
cin>>n[i];
}
sort(q,q+s);
sort(n,n+s);
for(int i=0,j=0;i<s&&j<s;)
{
if(q[i]<n[j])
{
count++;
i++;
j++;
}
else if(q[i]==n[j])
{
j++;
}
else
j++;
}
cout<<count<<endl;
return 0;
}
simple and easy problems , u only need to give victory any how to alogonia army.
No comments:
Post a Comment