只过了#0,谁来帮帮我。
#include<bits/stdc++.h>
using namespace std;
long long n,x,y,k=1;
struct car{
long long t;
long long where;
}a[10001];
bool cmp1(car x,car y){
return x.t<y.t;
}
bool cmp2(car x,car y){
return x.where<y.where;
}
string s;
int main(){
cin>>n;
a[0].t=0;
a[0].where=0;
for(int i=1;i<=n-1;i++){
cin>>s;
if(s=="Patrik"){
cin>>x;
a[i].t=x-a[i-1].t;
a[i].where=i;
}
else {
cin>>x>>y;
a[i].t=y-a[x].t;
a[i].where=i;
}
}
sort(a+1,a+n,cmp1);
while(a[k+1].t==a[k].t) k++;
sort(a+1,a+k+1,cmp2);
cout<<a[1].t<<" "<<a[1].where<<" "<<a[1].where+1<<"\n";
return 0;
}