Vorrei migliorare il punteggio di CANNONIERE
#include <algorithm>
using namespace std;
struct tipo
{ int giocatore;
int reti;
};
bool compare_tipo (const tipo &a, const tipo &b)
{ if (a.giocatore<b.giocatore )
return true;
else
return false;
}
int main() {
freopen("input.txt", "r",stdin );
freopen("output.txt", "w",stdout);
int N; int i;int cont=0;
cin>>N;
struct tipo G[N];
for(i=0; i<N; i++)
cin>>G[i].giocatore>>G[i].reti;
sort (G, G+N, compare_tipo);
int massimo=0, ind =0;
for (i=0;i<N-1;i++)
{ cont =G[i].reti;
for (int j=i+1;j<N; j++)
{ if (G[i].giocatore==G[j].giocatore)
{
cont=cont+G[j].reti;
if (massimo<cont) { massimo=cont;
ind=i; }
}
}
}
cout<<G[ind].giocatore<<" "<<massimo;
return 0;
}