改了cmp
```cpp
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
struct hi
{
long long id;
string s;
long long wei;
}ti[1000];
long long cmp(hi a,hi b){
if(a.wei==b.wei){
return b.s<a.s;
}
return b.wei<a.wei;
}
int main()
{
ios::sync_with_stdio(0);
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>ti[i].s;
ti[i].id=i;
ti[i].wei=ti[i].s.length() ;
}
sort(ti+1,ti+n+1,cmp);
cout<<ti[1].id<<endl;
cout<<ti[1].s<<endl;
return 0;
}
```
by SZW_LXZ @ 2024-03-11 22:17:47
@[SZW_LXZ](/user/970771) 谢,已关
by Konnyaku_q @ 2024-03-11 22:22:32