C题,哪位大神帮我看看,只过了60%
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
struct source
{
string s;
int a;
int num;
} sour[10011];
bool cmp(source a,source b)
{
return a.a<b.a;
}
int main()
{
int i,n;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>sour[i].s>>sour[i].a;
sour[i].num=i;
}
for(i=1;i<=n;i++)
{
for(int j=n+1;j<=n;j++)
{
if(sour[i].s==sour[j].s)
{source t;
t=sour[i];
sour[n]=sour[i];
t=sour[n];
n--;}
}
}
sort(sour+1,sour+n+1,cmp);
for(i=1;i<=n;i++)
{
cout<<sour[i].num<<endl;
}
}
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
struct source
{
string s;
int a;
int num;
} sour[10011];
bool cmp(source a,source b)
{
return a.a<b.a;
}
int main()
{
int i,n;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>sour[i].s>>sour[i].a;
sour[i].num=i;
}
for(i=1;i<=n;i++)
{
for(int j=n+1;j<=n;j++)
{
if(sour[i].s==sour[j].s)
{source t;
t=sour[i];
sour[n]=sour[i];
t=sour[n];
n--;}
}
}
sort(sour+1,sour+n+1,cmp);
for(i=1;i<=n;i++)
{
cout<<sour[i].num<<endl;
}
}